home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 April / PCWorld_2008-04_cd.bin / v cisle / allwaysync / allwaysync-7-0-1.exe / {app} / Skins / default / profileex.js < prev    next >
Text File  |  2007-11-29  |  222KB  |  5,017 lines

  1. // MFindItemByIndex
  2. // JavaScript Document
  3.  
  4. //    ----------------------------------------------------------------
  5. //    Constants:
  6. //    ----------------------------------------------------------------
  7.  
  8. CONST_ERR_QUESTION = 6000;
  9. CONST_MSG_STATE_EXCLUDED        = '6E79535F534953557178456D65744963';
  10. CONST_CID =                       '44D6005D4449435BBBF419FDC8367C08';
  11. CONST_WIN_NO_SYNC =               '535F4F4E5F4E49570000000000434E59';
  12. CONST_WIN_DEL_SYNC =              '4F4D45525F4E495700004C4C415F4556'; // WIN_REMOVE_ALL
  13. CONST_ACTION_STATE_INIT =        '535F4E4F49544341614E495F45544154';
  14. CONST_ACTION_STATE_IN_PROGRESS = '535F4E4F495443415A4E495F45544154';
  15. CONST_ACTION_STATE_DONE =        '535F4E4F49544341574F445F45544154';
  16. CONST_AssocTemplate = '';
  17. CONST_MESSAGES_ON_PAGE = 10;
  18. CONST_ShowFullFileName = true;
  19.  
  20. // Status attribute definitions.
  21. STATUS_ATTRIBUTE_AUTOMATIC           = 1;
  22. STATUS_ATTRIBUTE_AUTOMATIC_INTERNAL  = 2;
  23. STATUS_ATTRIBUTE_AUTOMATIC_DISABLED  = 3;
  24. STATUS_ATTRIBUTE_ANALYZING           = 4;
  25. STATUS_ATTRIBUTE_SYNCHRONIZING       = 5;
  26. STATUS_ATTRIBUTE_INFORMATION_MESSAGE = 6;
  27. STATUS_ATTRIBUTE_IMPORTANT_MESSAGE   = 7;
  28. STATUS_ATTRIBUTE_INCOMPLETE          = 8;
  29. STATUS_ATTRIBUTE_ANALYZE_ENABLED     = 9;
  30. STATUS_ATTRIBUTE_SYNCHRONIZE_ENABLED = 10;
  31. STATUS_ATTRIBUTE_STOP_ENABLED        = 11;
  32.  
  33. //    ----------------------------------------------------------------
  34. //    Global variables:
  35. //    ----------------------------------------------------------------
  36.  
  37. G_OnProfileChanged_called = false;
  38. G_OnAssocChanged_called = false;
  39. G_CounterRefreshFlag = false;
  40. G_AnalyzeHintCallCounter = 4;
  41. G_Folders_is_ready = false;
  42. G_OnDirectionChanged = false;
  43. G_filter_switched = false;
  44. //G_SynchronizeHintCallCounter = 3;
  45. G_TabScrollingProcessNum = 0;
  46. G_ActiveAssocID = '';
  47. G_Assocs = {}; //new Array();
  48. G_ProfileExist = false;
  49.  
  50. G_FirstAssocID = '';
  51. Flag_can_reload_profile = true;
  52.  
  53. G_Shown_message = {};
  54. G_Shown_message.msg_id = null;
  55. G_Shown_message.collection_id = null;
  56.  
  57. G_Collection_lock = false;
  58. //    ----------------------------------------------------------------
  59. //    Settings of middle message (Above_message)
  60. //     ----------------------------------------------------------------
  61.  
  62. G_Above_message = {};
  63. G_Above_message.msg_id = null;
  64. G_Above_message.collection_id = null;
  65. G_Above_message.mustshown = true;
  66. G_Above_message.latch = false;
  67.  
  68. //    ----------------------------------------------------------------
  69.  
  70. G_Caption_menu = false;
  71. G_Caption_menu_mustshown = false;
  72. G_Caption_menu_above = false;
  73. G_FocusInCaptionMenu = false;
  74.  
  75. G_AssocChangedCause = '';
  76.  
  77. G_Block = false;
  78.  
  79. G_DEBUG = false;
  80. G_debug_line_number = 1;
  81.  
  82. //    ----------------------------------------------------------------
  83. //    End of global variables definitions
  84. //     ----------------------------------------------------------------
  85.  
  86. function Body_onload()
  87.     {        
  88.     ApplicationName.innerText = external.GetAppName();    
  89.     //ApplicationName.innerHTML = '<span><img style="position:relative; top:4px; left:-15px;" src="Pics/Logotype.png"></span>' + 
  90.     //external.GetAppName() + ' ' + 
  91.     //'<span style="color:#414c32; font-size:18px;">' + 
  92.     //    external.LS("banner_version")+' '+ external.GetAppVersionUserStr()+
  93.     //'</span>';    
  94.     BannerSlogan.innerText = external.LS("banner_slogan");
  95.     VersionInBanner.innerHTML = external.LS("banner_version")+' '+external.GetAppVersionUserStr();    //external.LS("banner_version")
  96.     Select_sync_direction.innerHTML = external.LS("popup_select_direction");
  97.     If_remove_check_lbl.innerText = external.LS("check_remove_files");
  98.     If_remove_check_div.title = external.LS("hint_check_remove_files");
  99.     If_rewrite_check_lbl.innerText = external.LS("check_overwrite_files");
  100.     If_rewrite_check_div.title = external.LS("hint_check_overwrite_files");
  101.     Change_link.innerText = external.LS("popup_change_link");
  102.     Change_link.title = external.LS("tooltip_change_link");
  103.     AllWayRadio.title = external.LS('tooltip_all_way_sync');
  104.     CONST_AssocTemplate = AssocTemplate.innerHTML;
  105.     CONST_MESSAGES_ON_PAGE = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  106.     CONST_ShowFullFileName = external.Method1('M_GetGlobalOption', 'ShowFullFileName');
  107.     
  108.     var State = external.Method1('M_GetGlobalOption', 'ShowBanner');
  109.     ExtChangeBannerState(State);
  110.     
  111.     //------------------------------------------------------------
  112.     var ActiveAssocObj = external.Method0('M_GetSelectedAssoc');
  113.     G_ActiveAssocID = ActiveAssocObj.objID;
  114.     //------------------------------------------------------------        
  115.     LoadProfile();
  116.     ActivateAssoc(G_ActiveAssocID);    
  117.     UpdateButtons(G_ActiveAssocID);
  118.     
  119.     var AssocObj = external.ObjByID(G_ActiveAssocID);
  120.     var Status = AssocObj.Method0('M_GetAggregatedGeneralStatus');
  121.     UpdateAssocStatus(G_ActiveAssocID, Status);
  122.     
  123.     ResizeWindow();    
  124.     
  125.     initDHTMLAPI(); 
  126.     initDrag();    
  127.     }
  128.  
  129.  
  130. function LoadProfile()
  131.     {
  132.     //---------------------------------------------------
  133.     G_ProfileExist = false;
  134.     var profile = external.Method0Own('M_GetProfile');     
  135.     if (profile == null) return    G_ProfileExist;                
  136.     else                        G_ProfileExist = true;
  137.     //---------------------------------------------------
  138.     var Assocs_exist = false;
  139.     var AssocObj = profile.GetFirst();        
  140.     if(AssocObj == null)    return     Assocs_exist;
  141.     else                             Assocs_exist = true;
  142.     //---------------------------------------------------        
  143.     var ActiveAssoc_exist = false;
  144.     var FirstAssocID = AssocObj.objID;
  145.     // show all assocs from Profile
  146.     while(AssocObj != null)
  147.         {
  148.         if(G_ActiveAssocID == AssocObj.objID)    ActiveAssoc_exist = true;             
  149.         AddAssoc(AssocObj);
  150.         var AssocObj = profile.GetNext(AssocObj);
  151.         }    
  152.     //----------------------------------------------------------    
  153.     var ActiveAssocObj = external.Method0('M_GetSelectedAssoc');
  154.     if (ActiveAssocObj)
  155.         {        
  156.         G_ActiveAssocID = ActiveAssocObj.objID;    
  157.         ActiveAssoc_exist = true;
  158.         }
  159.     //----------------------------------------------------------
  160.     if(ActiveAssoc_exist != true)    G_ActiveAssocID = FirstAssocID;
  161.     return Assocs_exist;
  162.     }
  163.     
  164. //    --------------------------------------------------------------------
  165. // initialisation of association
  166. //    --------------------------------------------------------------------
  167. function InitAssoc(AssocObj)                                
  168.     {
  169.     var AssocID = AssocObj.objID;
  170.     //    -----------------------------------------------------------------------------------------------            
  171.     G_Assocs[AssocID]={};
  172.     G_Assocs[AssocID].self=AssocID;
  173.     G_Assocs[AssocID].Folders_is_ready = false;
  174.     G_Assocs[AssocID].FoldersQuantity = 2;
  175.     G_Assocs[AssocID].WinningSuperTreeID = CONST_CID;        // For one/all way synchronization switch
  176.     G_Assocs[AssocID].Folder_is_ready_array = new Array();
  177.     G_Assocs[AssocID].OnAssocChangedCalled = false;
  178.     G_Assocs[AssocID].TreeView = new CreateTree(AssocID, "tree","TreeView_element");
  179.     G_Assocs[AssocID].CollectionNodesExist = false;        
  180.     //    -----------------------------------------------------------------------------------------------            
  181.     AssocElement = document.getElementById('Assoc_'+AssocID);
  182.     AssocElement.all['B_ANALYZE'].innerText                 = external.LS("button_analyze");
  183.     AssocElement.all['B_ANALYZE'].title                     = external.LS("tooltip_Analyze_button");
  184.       AssocElement.all['B_ANALYZE'].association_id             = AssocID;
  185.     AssocElement.all['B_SYNC'].innerText                     = external.LS("button_synchronize");
  186.     AssocElement.all['B_SYNC'].title                         = external.LS("tooltip_Sinchronize_button");
  187.     AssocElement.all['B_SYNC'].association_id                 = AssocID;
  188.     AssocElement.all['B_STOP'].innerText                     = external.LS("button_clear");
  189.       AssocElement.all['B_STOP'].title                         = external.LS("tooltip_Stop_button");
  190.     AssocElement.all['B_STOP'].association_id                 = AssocID;
  191.     AssocElement.all['Important_warning_text'].innerText     = external.LS("important_warning");
  192.       AssocElement.all['Important_warning'].title             = external.LS("tooltip_Important_warning");
  193.     //    -----------------------------------------------------------------------------------------------            
  194.     }
  195.  
  196. function NewAssoc()
  197.     {
  198.     DeactivateAssoc(G_ActiveAssocID);                                //    Deactivate current association
  199.     solution = external.method0Own('M_GetDoProfileSyncSolution');    //    Get solution    
  200.     Flag_can_reload_profile = false;                                //    Lock ability to reload profile
  201.     AssocObj = solution.Method0('M_CreateAssocW2Trees');            //    Create association with two trees
  202.     AssocObj.Method0('M_CreateNewSyncTreeInAssoc');                    //    Create new sync tree
  203.     Flag_can_reload_profile = true;                                    //    Unlock ability to reload profile
  204.     AddAssoc(AssocObj);                                                //    Set assoc by default and redraw it                                                                                                                        
  205.     ActivateAssoc(AssocObj.objID);                                     //    make assoc as current and activate it    
  206.     }
  207.  
  208. //    -----------------------------------------------------------------------------------------------------------
  209. //    AddAssoc(AssocObj)     Create assoc label
  210. //                           Add html object for assoc,   
  211. //                         Call    InitAssoc(AssocObj)                     - set html assoc object by default
  212. //                                LoadAssocPaths(AssocID)                    - place rootfolders objects to assoc
  213. //                                G_Assocs[AssocID].TreeView.redraw()        - redraw all collections
  214. //
  215. //  association to assoc tree, set assoc by default and redraw it
  216. //    -----------------------------------------------------------------------------------------------------------
  217.  
  218. function AddAssoc(AssocObj)
  219.     {
  220.     //-----------------------------
  221.     var AssocID = AssocObj.objID;
  222.     //-----------------------------
  223.     if(TabsLabels.cells.length == 1)
  224.         {
  225.         LeftSeparatorCell = TabsLabels.insertCell(0);
  226.         LeftSeparatorCell.height = '26px';
  227.         LeftSeparatorCell.className = 'TabSeparatorCell';
  228.         LeftSeparatorCell.innerHTML = '<div class="TabSeparator_3">';
  229.         }
  230.         else
  231.         {
  232.         LeftSeparatorCell = TabsLabels.cells(TabsLabels.cells.length-2);
  233.         LeftSeparatorCell.children[0].className = 'TabSeparator_7';
  234.         }
  235.         
  236.     NewLabelCell = TabsLabels.insertCell(TabsLabels.cells.length-1);
  237.     NewLabelCell.id = 'Label_'+AssocID;
  238.     NewLabelCell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
  239.     NewLabelCell.style.cursor = "hand";
  240.     NewLabelCell.noWrap = true;
  241.     //---------------------------------------------------------------------------------------------------
  242.     var status = AssocObj.Method0('M_GetAggregatedGeneralStatus');
  243.     var status_src = 'Pics/Status_normal.gif';
  244.     //---------------------------------------------------------------------------------------------------
  245.     if        (status == 0)                                    status_src = 'Pics/Status_normal.gif';
  246.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC)            status_src = 'Pics/Status_schedule.gif';
  247.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC_INTERNAL)    status_src = 'Pics/Status_schedule.gif';
  248.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC_DISABLED)    status_src = 'Pics/Status_manual.gif';
  249.     else if    (status == STATUS_ATTRIBUTE_ANALYZING)            status_src = 'Pics/Status_analyze.gif';
  250.     else if    (status == STATUS_ATTRIBUTE_SYNCHRONIZING)        status_src = 'Pics/Status_synchronize.gif';
  251.     else if    (status == STATUS_ATTRIBUTE_INFORMATION_MESSAGE)status_src = 'Pics/Status_information.gif';
  252.     else if (status == STATUS_ATTRIBUTE_IMPORTANT_MESSAGE)  status_src = 'Pics/Status_important.gif';
  253.     else if    (status == STATUS_ATTRIBUTE_INCOMPLETE)            status_src = 'Pics/Status_incomplete.gif';
  254.     //---------------------------------------------------------------------------------------------------    
  255.     NewLabelCell.innerHTML =     '<div oncontextmenu="TabLabelContextMenu(\''+AssocID+'\')" '+
  256.                                 'onclick="TabLabelOnClick1(\''+AssocID+'\')" '+
  257.                                 'style="position:relative: top:0px; left:0px; width:100%; height:26px; padding-top:3px;">'+
  258.                                 '<img id="Status_img" src="'+status_src+'" '+
  259.                                 'style="position:relative; top:2px; left:0px; margin-right:3px; margin-left:-3px;">'+
  260.                                 '<span tabindex="1" onkeypress="TabLabelOnClick1(\''+AssocID+'\')" id="TabCaptionText">'+
  261.                                 AssocObj.Method0('M_GetAssocName')+'</span><div>';
  262.  
  263.     RightSeparatorCell = TabsLabels.insertCell(TabsLabels.cells.length-1);
  264.     RightSeparatorCell.className = 'TabSeparatorCell';
  265.     RightSeparatorCell.height = '26px';
  266.     RightSeparatorCell.innerHTML = '<div class="TabSeparator_4">';
  267.     TabsCaptionResized();
  268.     //---------------------------------------------------------------------------------------------------    
  269.     AssocsContainer.innerHTML =    AssocsContainer.innerHTML + '<div id="Assoc_'+AssocID+'" '+
  270.                                 'oncontextmenu="TabLabelContextMenu(\''+AssocID+'\')" '+
  271.                                 'style="position:absolute; width:100%; height:100%; visibility:hidden;">'+
  272.                                 CONST_AssocTemplate+'</div>';
  273.     
  274.     InitAssoc(AssocObj);
  275.     LoadAssocPaths(AssocID); 
  276.     G_Assocs[AssocID].TreeView.redraw();
  277.  
  278.     var El = document.getElementById('Assoc_'+AssocID);    
  279.     El.style.display='none';                
  280.     }
  281.     
  282. //    --------------------------------------------------------------------------
  283. //
  284. //    --------------------------------------------------------------------------
  285.  
  286. function RemoveAllAssocsFromScreen()
  287.     {
  288.     Hint_window.style.visibility = 'hidden';
  289.     var AssocQuantity = AssocsContainer.children.length;
  290.  
  291.     for(var i=0; i<AssocQuantity; i++)
  292.         {
  293.         var AssocElement = AssocsContainer.children(0);
  294.         var AssocID = AssocElement.id.replace(/Assoc_/,"");
  295.  
  296.         delete G_Assocs[AssocID]; 
  297.         AssocElement.removeNode(true);
  298.         
  299.         var LeftSeparatorCell = TabsLabels.cells(0);
  300.         var LabelCell = TabsLabels.cells(1);
  301.         TabsLabels.deleteCell(LeftSeparatorCell.cellIndex);
  302.         TabsLabels.deleteCell(LabelCell.cellIndex);
  303.         }
  304.         
  305.     if(AssocQuantity > 0)
  306.         {
  307.         var LastSeparatorCell = TabsLabels.cells(0);
  308.         TabsLabels.deleteCell(LastSeparatorCell.cellIndex);
  309.         }
  310.     TabsCaptionResized();
  311.     }
  312.     
  313. //    --------------------------------------------------------------------------
  314. //    functions for deactivation of specified accosiation
  315. //    --------------------------------------------------------------------------    
  316.  
  317. function DeactivateAssoc(AssocID)
  318.     {
  319.     var AssocElement = document.getElementById('Assoc_'+AssocID);
  320.     
  321.     for(i=0; i<G_Assocs[AssocID].FoldersQuantity; i++)    //Deactivate_form(i, AssocID);    
  322.         {
  323.         ExtCloseHint(AssocID, "Syncpath_hint_"+i);    
  324.         //----------------------------------------------    
  325.         SyncTree_elem = AssocElement.all["SyncTree"+i];            
  326.         SyncTree_elem.className = "Unactive_panel";    
  327.         //----------------------------------------------
  328.         Form_elem = AssocElement.all["TreeForm"+i];
  329.         if(Form_elem.is_changed == "true")    ChangeSyncTree(num);
  330.         }    
  331.     //---------------------------------------------------------------------        
  332.     AssocElement.style.visibility = 'hidden';
  333.     AssocElement.style.display = 'none';
  334.     //---------------------------------------------------------------------
  335.     var FirstLabelIndex = 1;
  336.     var LastLabelIndex = TabsLabels.cells.length - 3;
  337.     //---------------------------------------------------------------------
  338.     var LabelCell = TabsLabels.cells['Label_'+AssocID];
  339.     var LabelCellIndex = LabelCell.cellIndex;
  340.     var LeftSeparatorCell = TabsLabels.cells(LabelCellIndex-1);
  341.     var RightSeparatorCell = TabsLabels.cells(LabelCellIndex+1);
  342.     LabelCell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
  343.     //---------------------------------------------------------------------
  344.     LeftSeparatorCell.children(0).className     = 'TabSeparator_7';//    Unactive/Unactive
  345.     RightSeparatorCell.children(0).className    = 'TabSeparator_7';//    Unactive/Unactive
  346.     if        (LabelCellIndex == FirstLabelIndex)    LeftSeparatorCell.children(0).className     = 'TabSeparator_3';//    Empty/Unactive        
  347.     else if (LabelCellIndex == LastLabelIndex)    RightSeparatorCell.children(0).className     = 'TabSeparator_4';//    Unactive/Empty        
  348.     }
  349.  
  350. //    -------------------------------------------------------------------------
  351.     
  352. function Deactivate_form(num, AssocID)
  353.     {
  354.     ExtCloseHint(AssocID, "Syncpath_hint_"+num);
  355.     AssocElement = document.getElementById('Assoc_'+AssocID);
  356.     SyncTree_elem = AssocElement.all["SyncTree"+num];
  357.     Form_elem = AssocElement.all["TreeForm"+num];    
  358.     if(Form_elem.is_changed == "false")
  359.         {
  360.         SyncTree_elem.className = "Unactive_panel";
  361.         }
  362.     else if(SyncTree_elem.contains(window.event.toElement) == false)
  363.             {
  364.             SyncTree_elem.className = "Unactive_panel";
  365.             ChangeSyncTree(num);
  366.             }
  367.     }
  368.  
  369. //    --------------------------------------------------------------------------
  370. //
  371. //    --------------------------------------------------------------------------
  372.  
  373. function ActivateAssoc(AssocID)
  374.     {
  375.     var AssocElement = document.getElementById('Assoc_'+AssocID);
  376.     if(AssocElement == null) return;
  377.     //------------------------------------------        
  378.     AssocElement.style.display = '';
  379.     AssocElement.style.visibility = 'visible';    
  380.     //------------------------------------------        
  381.     var LastLabelIndex = TabsLabels.cells.length - 3;
  382.     var FirstLabelIndex = 1;
  383.     var LabelCell = TabsLabels.cells['Label_'+AssocID];
  384.     var LabelCellIndex = LabelCell.cellIndex; 
  385.     var LeftSeparatorCell = TabsLabels.cells(LabelCellIndex-1);
  386.     var RightSeparatorCell = TabsLabels.cells(LabelCellIndex+1);
  387.     LabelCell.style.backgroundImage = "url('Pics/TabCaptionMid2.gif')";
  388.     //------------------------------------------        
  389.     LeftSeparatorCell.children(0).className = 'TabSeparator_5';    // Unactive/Active
  390.     RightSeparatorCell.children(0).className = 'TabSeparator_6';    // Active/Unactive
  391.     
  392.     if(LabelCellIndex == FirstLabelIndex)    LeftSeparatorCell.children(0).className = 'TabSeparator_1';    //    Empty/Active
  393.     if(LabelCellIndex == LastLabelIndex)    RightSeparatorCell.children(0).className = 'TabSeparator_2';    //    Active/Empty
  394.         
  395.     external.Method1('M_SelectAssoc', external.ObjByID(AssocID));
  396.     G_ActiveAssocID = AssocID;
  397.     
  398.     if (G_Assocs[AssocID].CollectionNodesExist == false)
  399.     {    
  400.     G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_UserMessagesImportant'),'Important',        external.LS('MM_UserMessagesImportant'));
  401.     G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_UserMessagesInformation'),'Information',    external.LS('MM_UserMessagesInformation'));
  402.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_SyncItemQuestionable'), 'Questionable',     external.LS('MM_SyncItemQuestionable'));
  403.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'USIS_SyncItemDeleted'),    'Deleted',        external.LS('USIS_SyncItemDeleted'));
  404.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'USIS_SyncItemNew'),        'New',            external.LS('USIS_SyncItemNew'));
  405.      G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'USIS_SyncItemChanged'),    'Changed',        external.LS('USIS_SyncItemChanged'));
  406.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'USIS_SyncItemUnchanged'),    'Unchanged',        external.LS('USIS_SyncItemUnchanged'));
  407.     G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_SyncItemsAll'),            'All',            external.LS('MM_SyncItemsAll'));    
  408.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'USIS_SyncItemExcluded'),    'Excluded',        external.LS('USIS_SyncItemExcluded'));
  409.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_OverwriteByUser'),         'OverwriteByUser',     external.LS('MM_OverwriteByUser'));
  410.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_SyncFindItems'),        'SyncFindItems',    external.LS('MM_SyncFindItems'));
  411.     G_Assocs[AssocID].CollectionNodesExist = true;
  412.     }
  413.         
  414.     ScrollTabLabelIntoView(AssocID);
  415.     LoadAssocPaths(AssocID);    
  416.     G_Assocs[AssocID].TreeView.redraw(); // !!! added because of replacing of collection nodes creating    
  417.     UpdateButtons(AssocID);    
  418.     ExtCountersRefresh();
  419.     ExtUpdateProgressBar(AssocID, external.Method0('M_GetProgressState'), external.Method0('M_GetProgressPercent')); // New !!
  420.     }
  421.  
  422. //    --------------------------------------------------------------------------
  423. //
  424. //    --------------------------------------------------------------------------
  425.  
  426. function ExtOnAssocChanged(AssocID)
  427.     {
  428.     var d = new Date();
  429.  
  430.     if(Flag_can_reload_profile == false)
  431.         {
  432.         return;
  433.         }
  434.         
  435.     var AssocObj = external.ObjByID(AssocID);
  436.     
  437.     if((G_AssocChangedCause == 'Propagate_set') && (AssocID == G_ActiveAssocID))
  438.         {
  439.         If_remove_check.checked = AssocObj.Method0('M_GetMimicDeleted');
  440.         If_rewrite_check.checked = AssocObj.Method0('M_GetMimicChanged');
  441.         return;
  442.         }
  443.         
  444.     if(G_AssocChangedCause == 'SyncDirectionChanged')
  445.         {
  446.         if(AssocID == G_ActiveAssocID)
  447.             {
  448.             If_remove_check.checked = AssocObj.Method0('M_GetMimicDeleted');
  449.             If_rewrite_check.checked = AssocObj.Method0('M_GetMimicChanged');
  450.             }
  451.             
  452.         var SyncDirection = AssocObj.Method0('M_GetSyncDirection');
  453.         
  454.         if((typeof(SyncDirection) == 'string') && (SyncDirection == external.AbbrToHex('DIRECTION_ALL_WAY'))) 
  455.             {   
  456.             G_Assocs[AssocID].WinningSuperTreeID = CONST_CID;
  457.             var NewWinningSuperTreeID = 'DIRECTION_ALL_WAY';    
  458.             } 
  459.             else 
  460.             {
  461.             G_Assocs[AssocID].WinningSuperTreeID = SyncDirection.objID;
  462.             var NewWinningSuperTreeID = SyncDirection.objID;
  463.             }
  464.             
  465.         SwitchSyncDirectionArrow(AssocID, NewWinningSuperTreeID);
  466.         
  467.         return;
  468.         }
  469.         
  470.     var LabelText = TabsLabels.cells['Label_'+AssocID].all['TabCaptionText'];
  471.     
  472.     LabelText.innerText = AssocObj.Method0('M_GetAssocName');
  473.     G_Assocs[AssocID].OnAssocChangedCalled = true;
  474.         
  475.     if(LoadAssocPaths(AssocID) == true)
  476.         {
  477.         if((G_AnalyzeHintCallCounter > 0) && (G_OnDirectionChanged == false) && (G_filter_switched == false))
  478.             {
  479.             var AssocElement = document.getElementById('Assoc_'+AssocID);
  480.             if((AssocElement != null) && (!AssocElement.all['B_ANALYZE'].disabled))
  481.                 {
  482.                 ExtGiveHint(AssocID, "Analyze_hint");
  483.                 G_AnalyzeHintCallCounter--;
  484.                 }
  485.             }
  486.             
  487.         if(AssocID == G_ActiveAssocID && (G_filter_switched == false))
  488.             {
  489.             setTimeout("FocusToAnalyze('"+AssocID+"')", 0);
  490.             }
  491.             
  492.         G_filter_switched = false;
  493.         }
  494.     }
  495.  
  496. //    --------------------------------------------------------------------------
  497. //
  498. //    --------------------------------------------------------------------------
  499.  
  500. function FocusToAnalyze(AssocID)
  501.     {
  502.     if(AssocID != G_ActiveAssocID)
  503.         {
  504.         return;
  505.         }
  506.     AssocElement = document.getElementById('Assoc_'+AssocID);
  507.     AnalyzeButtonElement = AssocElement.all['B_ANALYZE'];
  508.     if(AnalyzeButtonElement.disabled == false)
  509.         {
  510.         AnalyzeButtonElement.focus();
  511.         }
  512.     }
  513.  
  514. //    --------------------------------------------------------------------------
  515. //
  516. //    --------------------------------------------------------------------------
  517.  
  518. function FocusToSyncpath(AssocID, num)
  519.     {
  520.     if(AssocID != G_ActiveAssocID)
  521.         {
  522.         return;
  523.         }
  524.     AssocElement = document.getElementById('Assoc_'+AssocID);
  525.     TreePathDiv = AssocElement.all["TreePath"+num];
  526.     if(TreePathDiv.disabled == false)
  527.         {
  528.         PlaceHintWindow(TreePathDiv, num);
  529.         ExtGiveHint(AssocID, "Syncpath_hint_"+num);
  530.         TreePathDiv.children(0).focus();
  531.         }
  532.     }
  533.  
  534. //    --------------------------------------------------------------------------
  535. //    
  536. //    --------------------------------------------------------------------------
  537.  
  538. function SwitchSyncDirectionArrow(AssocID, NewWinningSuperTreeID)
  539.     {
  540.     var AssocObj = external.ObjByID(AssocID);
  541.     var Assoc_element = document.getElementById('Assoc_'+AssocID);
  542.     var SyncBoardsTableBody_element = Assoc_element.all['SyncBoardsTable'].all[0];
  543.     var FoldersQuantity    = G_Assocs[AssocID].FoldersQuantity;
  544.     var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  545.     if(SuperTreeList == null)
  546.         {
  547.         alert('SuperTreeList == null');
  548.         return 0;
  549.         }
  550.     var tbody_length = SyncBoardsTableBody_element.rows.length;
  551.     
  552.     
  553.     var SyncTreeArray = new Array();
  554.     var SyncTreeList_length = 0;
  555.     var Delete_buttons_html = '';
  556.     var If_one_way_sync = false;
  557.     var SuperTree_Obj = SuperTreeList.GetFirst();
  558.     while(SuperTree_Obj != null)
  559.         {
  560.         SyncTreeArray[SyncTreeList_length] = {};
  561.         SyncTree_Obj = SuperTree_Obj.GetFirst();
  562.         if(SyncTree_Obj == null)
  563.             {
  564.             alert('SuperTree does not contain any SyncTree');
  565.             return 0;
  566.             }
  567.         if(NewWinningSuperTreeID == SuperTree_Obj.objID)
  568.             {
  569.             SyncTreeArray[SyncTreeList_length].cap_arrow_direction = '_out';
  570.             SyncTreeArray[SyncTreeList_length].radio = 'active';
  571.             If_one_way_sync = true;
  572.             }
  573.             else
  574.             {
  575.             SyncTreeArray[SyncTreeList_length].cap_arrow_direction = '';
  576.             SyncTreeArray[SyncTreeList_length].radio = 'unactive';
  577.             }
  578.         
  579. //        SyncTreeArray[SyncTreeList_length].obj = SyncTree_Obj;
  580.         SyncTreeArray[SyncTreeList_length].superID = SuperTree_Obj.objID;
  581.         SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  582.         SyncTreeList_length++;
  583.         }
  584.     if(SyncTreeList_length != FoldersQuantity)
  585.         {
  586.         return;
  587.         }
  588.     Assoc_element.all['TopCapArrowLeft'].className = 'Cap_arrow_left'+SyncTreeArray[0].cap_arrow_direction;
  589.     Assoc_element.all['TopCapArrowRight'].className = 'Cap_arrow_right'+SyncTreeArray[1].cap_arrow_direction;
  590.     Assoc_element.all['TopCapRadioLeft'].children[0].src = 'Pics/Radio_left_'+SyncTreeArray[0].radio+'.gif';
  591.     Assoc_element.all['TopCapRadioRight'].children[0].src = 'Pics/Radio_right_'+SyncTreeArray[1].radio+'.gif';
  592.     
  593.     for(i=2; i<FoldersQuantity; i++)
  594.         {    
  595.         var row_element = SyncBoardsTableBody_element.rows[i-1];
  596.         var RightArrowCell = row_element.cells[3];
  597.         var RightRadioCell = row_element.cells[4];
  598.         RightArrowCell.children[0].className = 'Cap_arrow_right'+SyncTreeArray[i].cap_arrow_direction;
  599.         RightRadioCell.children[0].src = 'Pics/Radio_right_'+SyncTreeArray[i].radio+'.gif';
  600.         }
  601.         
  602.     if(AssocID == G_ActiveAssocID)
  603.         {
  604.         if(NewWinningSuperTreeID == 'DIRECTION_ALL_WAY')
  605.             {
  606.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way.gif';
  607.             }
  608.             else
  609.             {
  610.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way_unactive.gif';
  611.             }
  612.         }
  613.         
  614.     }
  615.  
  616. //    --------------------------------------------------------------------------
  617. //
  618. //    --------------------------------------------------------------------------
  619.  
  620. function LoadAssocPaths(AssocID)
  621.     {
  622.     //-------------------------------------------------------------------------------
  623.     var AssocObj = external.ObjByID(AssocID);
  624.     var Assoc_element = document.getElementById('Assoc_'+AssocID);
  625.     var SyncBoardsTableBody_element = Assoc_element.all['SyncBoardsTable'].all[0];
  626.     var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  627.     //-------------------------------------------------------------------------------
  628.     if(SuperTreeList == null)    return 0;
  629.     //-------------------------------------------------------------------------------
  630.     var tbody_length = SyncBoardsTableBody_element.rows.length;    
  631.     for(i=tbody_length-1; i>0; i--)        SyncBoardsTableBody_element.deleteRow(i);
  632.     //-------------------------------------------------------------------------------    
  633.     var SyncTreeArray = new Array();
  634.     var SyncTreeList_length = 0;
  635.     var SuperTree_Obj = SuperTreeList.GetFirst();
  636.     var Delete_buttons_html = '';
  637.     var If_one_way_sync = false;
  638.     var SyncDirection = AssocObj.Method0('M_GetSyncDirection');
  639.     //-------------------------------------------------------------------------------    
  640.     if    ((typeof(SyncDirection) == 'string') && 
  641.           (SyncDirection == external.AbbrToHex('DIRECTION_ALL_WAY')))    G_Assocs[AssocID].WinningSuperTreeID = CONST_CID;    
  642.     else                                                                 G_Assocs[AssocID].WinningSuperTreeID = SyncDirection.objID;
  643.     //------------------------------------------------------------------------------------------------------------------------------    
  644.     
  645.     var WinningSuperTreeID = G_Assocs[AssocID].WinningSuperTreeID;
  646.     
  647.     while(SuperTree_Obj != null)
  648.         {
  649.         SyncTreeArray[SyncTreeList_length] = {};
  650.         SyncTree_Obj = SuperTree_Obj.GetFirst();
  651.         if(SyncTree_Obj == null)
  652.             {
  653.             alert('SuperTree does not contain any SyncTree');
  654.             return 0;
  655.             }
  656.         if(WinningSuperTreeID == SuperTree_Obj.objID)
  657.             {
  658.             SyncTreeArray[SyncTreeList_length].cap_arrow_direction = '_out';
  659.             SyncTreeArray[SyncTreeList_length].radio = 'active';
  660.             If_one_way_sync = true;
  661.             }
  662.             else
  663.             {
  664.             SyncTreeArray[SyncTreeList_length].cap_arrow_direction = '';
  665.             SyncTreeArray[SyncTreeList_length].radio = 'unactive';
  666.             }
  667.         
  668.         SyncTreeArray[SyncTreeList_length].obj = SyncTree_Obj;
  669.         SyncTreeArray[SyncTreeList_length].superID = SuperTree_Obj.objID;
  670.         SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  671.         SyncTreeList_length++;
  672.         }
  673.     //-------------------------------------------------------------------------------    
  674.     G_Assocs[AssocID].FoldersQuantity = SyncTreeArray.length;
  675.     delete G_Assocs[AssocID].Folder_is_ready_array;
  676.     G_Assocs[AssocID].Folder_is_ready_array = new Array();    
  677.     Assoc_element.all['Cap_arrow_branch'].className = "Cap_arrow_branch0";
  678.     //-------------------------------------------------------------------------------    
  679.     for(i=0; i<2; i++)    //First Sync board table row
  680.         {
  681.         var result = BuildFolderPanel(SyncBoardsTableBody_element.all['SyncTree'+i], SyncTreeArray[i].obj, i);
  682.         G_Assocs[AssocID].Folder_is_ready_array[i] = result;
  683.         SyncTreeArray[i].if_ready = result;
  684.         }
  685.         
  686.     Assoc_element.all['TopCapArrowLeft'].className  = 'Cap_arrow_left'+SyncTreeArray[0].cap_arrow_direction;
  687.     Assoc_element.all['TopCapArrowRight'].className = 'Cap_arrow_right'+SyncTreeArray[1].cap_arrow_direction;    
  688.     Assoc_element.all['TopCapRadioLeft'].innerHTML  = '<img tabindex="3" src="Pics/Radio_left_'+SyncTreeArray[0].radio+'.gif" class="Cap_Radio_control" onkeypress="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[0].superID+'\')" onclick="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[0].superID+'\')" title="'+external.LS('tooltip_one_way_sync')+'" onactivate="CapMenuFocusIn()" ondeactivate="CapMenuFocusOut()">';    
  689.     Assoc_element.all['TopCapRadioRight'].innerHTML = '<img tabindex="3" src="Pics/Radio_right_'+SyncTreeArray[1].radio+'.gif" class="Cap_Radio_control" onkeypress="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[1].superID+'\')" onclick="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[1].superID+'\')" title="'+external.LS('tooltip_one_way_sync')+'" onactivate="CapMenuFocusIn()" ondeactivate="CapMenuFocusOut()">';
  690.     
  691.     if(SyncTreeArray.length > 2)
  692.         {
  693.         Assoc_element.all['Cap_arrow_branch'].className = "Cap_arrow_branch1";
  694.         
  695.         for(i=2; i<(SyncTreeArray.length-1); i++)
  696.             {    //All middle forders
  697.             var NewRow = SyncBoardsTableBody_element.insertRow();
  698.             var EmptyFolderCell = NewRow.insertCell();
  699.             var EmptyCell = NewRow.insertCell();
  700.             EmptyCell.colSpan = '3';
  701.             EmptyCell.onclick=CapMenuClick;
  702.             EmptyCell.onmouseleave=CapMenuLeave;
  703.             EmptyCell.onmouseenter=CapMenuEnter;
  704.             EmptyCell.className = 'CapMenuPlate';
  705.             var BranchCell = NewRow.insertCell();
  706.             BranchCell.innerHTML = '<div class="Cap_arrow_branch_middle"></div>';
  707.             BranchCell.onclick=CapMenuClick;
  708.             BranchCell.onmouseleave=CapMenuLeave;
  709.             BranchCell.onmouseenter=CapMenuEnter;
  710.             BranchCell.className = 'CapMenuPlate';
  711.             var RightArrowCell = NewRow.insertCell();
  712.             RightArrowCell.height = '30';
  713.             RightArrowCell.innerHTML = '<div class="Cap_arrow_right'+SyncTreeArray[i].cap_arrow_direction+'"></div>';
  714.             RightArrowCell.onclick=CapMenuClick;
  715.             RightArrowCell.onmouseleave=CapMenuLeave;
  716.             RightArrowCell.onmouseenter=CapMenuEnter;
  717.             RightArrowCell.className = 'CapMenuPlate';
  718.             var RadioCell = NewRow.insertCell();
  719.             RadioCell.innerHTML = '<img tabindex="3" src="Pics/Radio_right_'+SyncTreeArray[i].radio+'.gif" class="Cap_Radio_control" onkeypress="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[i].superID+'\')" onclick="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[i].superID+'\')" title="'+external.LS('tooltip_one_way_sync')+'" onactivate="CapMenuFocusIn()" ondeactivate="CapMenuFocusOut()">';
  720.             RadioCell.onclick=CapMenuClick;
  721.             RadioCell.onmouseleave=CapMenuLeave;
  722.             RadioCell.onmouseenter=CapMenuEnter;
  723.             RadioCell.className = 'CapMenuPlate';
  724.             RadioCell.style.padding="5px";
  725.             var FolderCell = NewRow.insertCell();
  726.             FolderCell.bgcolor ="red"; //#C0C0B4
  727.             FolderCell.style.padding = "0px";
  728.             FolderCell.innerHTML = '<div style="position:relative; top:0; left:0;">'+
  729.                                 '<div id="Syncpath_hint_'+i+'" class="Right_hint_hidden"></div>'+
  730.                                 '</div>'+
  731.                                 '<div id="SyncTree'+i+'" synctree_id="" style="position:relative; width:100%; border:solid 1px #88BAC8;"></div>';
  732.     
  733.             var result = BuildFolderPanel(SyncBoardsTableBody_element.all['SyncTree'+i], SyncTreeArray[i].obj, i);
  734.             G_Assocs[AssocID].Folder_is_ready_array[i] = result;
  735.             SyncTreeArray[i].if_ready = result;
  736.             } 
  737.         
  738.         i = SyncTreeArray.length-1;
  739.         // --- Last folder
  740.         var NewRow = SyncBoardsTableBody_element.insertRow();
  741.         var EmptyFolderCell = NewRow.insertCell();
  742.         var EmptyCell = NewRow.insertCell();
  743.         
  744.         EmptyCell.colSpan = '3';
  745.         EmptyCell.onclick=CapMenuClick;
  746.         EmptyCell.onmouseleave=CapMenuLeave;
  747.         EmptyCell.onmouseenter=CapMenuEnter;
  748.         EmptyCell.className = 'CapMenuPlate';
  749.         
  750.         var BranchCell = NewRow.insertCell();
  751.         
  752.         BranchCell.innerHTML = '<div class="Cap_arrow_branch_bottom"></div>';
  753.         BranchCell.onclick=CapMenuClick;
  754.         BranchCell.onmouseleave=CapMenuLeave;
  755.         BranchCell.onmouseenter=CapMenuEnter;
  756.         BranchCell.className = 'CapMenuPlate';
  757.         
  758.         var RightArrowCell = NewRow.insertCell();
  759.         
  760.         RightArrowCell.height = '30';
  761.         RightArrowCell.innerHTML = '<div class="Cap_arrow_right'+SyncTreeArray[i].cap_arrow_direction+'"></div>';
  762.         RightArrowCell.onclick=CapMenuClick;
  763.         RightArrowCell.onmouseleave=CapMenuLeave;
  764.         RightArrowCell.onmouseenter=CapMenuEnter;
  765.         RightArrowCell.className = 'CapMenuPlate';
  766.         
  767.         var RadioCell = NewRow.insertCell();
  768.         
  769.         RadioCell.innerHTML = '<img tabindex="3" src="Pics/Radio_right_'+SyncTreeArray[i].radio+'.gif" class="Cap_Radio_control" onkeypress="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[i].superID+'\')" onclick="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[i].superID+'\')" title="'+external.LS('tooltip_one_way_sync')+'" onactivate="CapMenuFocusIn()" ondeactivate="CapMenuFocusOut()">';
  770.         RadioCell.onclick=CapMenuClick;
  771.         RadioCell.onmouseleave=CapMenuLeave;
  772.         RadioCell.onmouseenter=CapMenuEnter;
  773.         RadioCell.className = 'CapMenuPlate';
  774.         RadioCell.style.padding="5px";
  775.         
  776.         var FolderCell = NewRow.insertCell();
  777.         
  778.         FolderCell.bgcolor ="#C0C0B4"; 
  779.         FolderCell.style.padding = "0px";
  780.         FolderCell.innerHTML = '<div style="position:relative; top:0; left:0;">'+
  781.                             '<div id="Syncpath_hint_'+i+'" class="Right_hint_hidden"></div>'+
  782.                             '</div>'+
  783.                             '<div id="SyncTree'+i+'" synctree_id="" style="position:relative; width:100%; border:solid 1px #88BAC8;"></div>';
  784.         
  785.         var result = BuildFolderPanel(SyncBoardsTableBody_element.all['SyncTree'+i], SyncTreeArray[i].obj, i);
  786.         
  787.         G_Assocs[AssocID].Folder_is_ready_array[i] = result;
  788.         SyncTreeArray[i].if_ready = result;
  789. //        ------------------        
  790.         }
  791.     if(AssocID == G_ActiveAssocID)
  792.         {
  793.         if(WinningSuperTreeID == CONST_CID)
  794.             {
  795.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way.gif';
  796.             }
  797.             else
  798.             {
  799.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way_unactive.gif';
  800.             }
  801.         If_remove_check.checked = AssocObj.Method0('M_GetMimicDeleted');
  802.         If_rewrite_check.checked = AssocObj.Method0('M_GetMimicChanged');
  803.         // fixing of bug with vertical lilnes
  804.         // will be
  805.         ResizeWindow();
  806.         }
  807.     // before fixing of bug with vertical lines     
  808.     // ResizeWindow();
  809.     
  810.     var HintCalledNumber = -1;
  811.     
  812.     for(i=SyncTreeArray.length-1; i>=0; i--)
  813.         {
  814.         if(SyncTreeArray[i].if_ready == false)
  815.             {
  816.             HintCalledNumber = i;
  817.             }
  818.         }
  819.         
  820.     if(HintCalledNumber != -1)
  821.         {
  822.         G_Assocs[AssocID].Folders_is_ready = false;
  823.         setTimeout("FocusToSyncpath('"+AssocID+"', '"+HintCalledNumber+"')", 0);
  824.         return 0;
  825.         }
  826.         
  827.     G_Assocs[AssocID].Folders_is_ready = true;
  828.     
  829.     return true;
  830.     }
  831.  
  832. //    --------------------------------------------------------------------------
  833. //
  834. //    --------------------------------------------------------------------------
  835.  
  836. function BuildFolderPanel(SyncTreeElement, SyncTreeObject, FolderNum)    //    Returns true if tree is ready and false otherwise
  837.     {
  838.     SyncTreeElement.synctree_id=SyncTreeObject.objID;
  839.     if(SyncTreeObject.Method0('M_IsTreeReady') == 1)
  840.         {
  841.         SyncTree_path = SyncTreeObject.Method0Own('M_ToViewFilename'); 
  842.         if_empty_flag = "false";
  843.         IfTreeReady = true;
  844.         }
  845.         else
  846.         {
  847.         SyncTree_path ="";
  848.         if_empty_flag = "true";
  849.         IfTreeReady = false;
  850.         }
  851.     SyncTreeElement.innerHTML = '<form id="TreeForm'+FolderNum+'" onSubmit="return ChangeSyncTree('+FolderNum+');" style="margin:0px;" title="'+
  852.                                 external.LS("tooltip_sync_board_right")+
  853.                                 '"  ondeactivate="Deactivate_form('+FolderNum+',\''+G_ActiveAssocID+'\')" is_changed="false" is_empty="'+if_empty_flag+'">'+
  854.                                     '<table width="100%" cellspacing="0">'+
  855.                                         '<tr>'+
  856.                                             '<td colspan="3" width="100%" height="22px;">'+
  857.                                                 '<div style="position:relative; top:0px; left:0px; height:22px;">'+ 
  858.                                                     '<div id="TreePath'+FolderNum+'" style="position:absolute; top:0px; left:0px; width:100%; height:25px;">'+
  859.                                                         '<input tabindex="2" id="'+SyncTreeObject.objID+'_path" type="text" value="'+SyncTree_path+
  860.                                                         '" style="width:100%; border: solid 1px black; background:#f6f6f6; font-family:tahoma; font-size:10pt;" onkeyup="Ok_Activate('+
  861.                                                         FolderNum+')" onactivate="Activate_form('+FolderNum+')">'+
  862.                                                     '</div>'+
  863.                                                 '</div>'+    
  864.                                             '</td>'+
  865.                                         '</tr>'+
  866.                                         '<tr>'+
  867.                                             '<td nowrap>'+ 
  868.                                                  '<span title="'+ external.LS("tooltip_FSP_Open") +
  869.                                                   '" tabindex="2" name="TreeOpen'+FolderNum+'" id="TreeOpen'+FolderNum+'" onclick="OpenSyncTree(' +
  870.                                                   FolderNum+')"  onmouseenter=FolderButtonSelect(this) onmouseleave=FolderButtonUnselect(this) style="width:67px; height: 20px; ' + 
  871.                                                   'font-size:11px; font-family:Arial; padding-top:3px; text-align: center; color:black; background:url(Pics/Folder_button.gif) background-position:top left;">' +
  872.                                                   external.LS("button_open")+'</span>'+
  873.                                                   
  874.                                                  '<span title="'+ external.LS("tooltip_FSP_Browse") +
  875.                                                   '" tabindex="2" name="TreeBrowse'+FolderNum+'" id="TreeBrowse'+FolderNum+'" onclick=BrowseSyncTree(' +
  876.                                                   FolderNum+') onmouseenter=FolderButtonSelect(this) onmouseleave=FolderButtonUnselect(this) style="width:67px; height: 20px; ' + 
  877.                                                   'font-size:11px; font-family:Arial; padding-top:3px; text-align: center; color:black; background:url(Pics/Folder_button.gif) background-position:top left;">' +
  878.                                                   external.LS("button_browse")+'</span>'+
  879.                                                '</td>'+
  880.                                                '<td width="100%">'+
  881.                                                '</td>'+
  882.                                                '<td id="TreeSubmitButtons'+FolderNum+'" nowrap>'+
  883.                                                  '<span title="'+ external.LS("tooltip_FSP_Ok") +
  884.                                                  '" tabindex="2" type="submit" name="TreeOk'+FolderNum + '" disabled id="TreeOk'+FolderNum + '" onclick="return ChangeSyncTree('+FolderNum+');"' +
  885.                                                  'onmouseenter=FolderButtonSelect(this) onmouseleave=FolderButtonUnselect(this) style="width:67px; height: 20px; ' + 
  886.                                                  'font-size:11px; font-family:Arial; padding-top:3px; text-align: center; color:black; background:url(Pics/Folder_button_off.gif) background-position:top left;">' +
  887.                                                  external.LS("button_ok")+'</span>'+
  888.                                                  
  889.                                                  '<span title="'+ external.LS("tooltip_FSP_Cancel") +
  890.                                                   '" tabindex="2" name="TreeCancel'+FolderNum + '" disabled id="TreeCancel'+FolderNum + '" onclick="CancelSyncTree('+FolderNum+');"'+
  891.                                                   'onmouseenter=FolderButtonSelect(this) onmouseleave=FolderButtonUnselect(this) style="width:67px; height: 20px; ' + 
  892.                                                   'font-size:11px; font-family:Arial; text-color: black; padding-top:3px; text-align: center; color:black; background:url(Pics/Folder_button_off.gif) background-position:top left;">' +
  893.                                                   external.LS("button_cancel")+'</span>'+
  894.                                             '</td>'+
  895.                                         '</tr>'+
  896.                                     '</table>'+
  897.                                 '</form>';
  898.     return IfTreeReady;
  899.     }
  900.  
  901. //    --------------------------------------------------------------------------
  902. //
  903. //    --------------------------------------------------------------------------
  904.  
  905. function OnCollectionExpandIconClick(AssocID, CollectionID)
  906.     {
  907.     G_Assocs[AssocID].TreeView.click(CollectionID);
  908.     }
  909. //-----------------------------------------------------------------------------------------    
  910. //
  911. //-----------------------------------------------------------------------------------------    
  912. function go_next_message(CollectionID)           
  913. {
  914.     G_Collection_lock = true;
  915.     //-----------------------
  916.     var collection_container = document.all[CollectionID+'_container']; 
  917.      if(collection_container == null) { G_Collection_lock = false; return;}
  918.     //-----------------------------------------------------------------------------------------    
  919.     var msgs = external.ObjByID(CollectionID);
  920.     var msgs_count = collection_container.children.length;
  921.     MsgID = collection_container.children(msgs_count - 1).id;
  922.     var new_on_page_last_msg = msgs.GetNext(msgs.ObjByID(MsgID))
  923.     if (new_on_page_last_msg == null) { G_Collection_lock = false; return;}
  924.     var new_on_page_last_msg_id = msgs.GetNext(msgs.ObjByID(MsgID)).objID;    
  925.     //----------------------------------------------------------
  926.     var MsgID = collection_container.children(0).id;
  927.     var message_container_element = collection_container.all[MsgID];
  928.     if (message_container_element)     message_container_element.removeNode(true);
  929.     //-----------------------------------------------------------------------------------------    
  930.     var current_first_message_element_index = msgs.Method0('M_GetFirstVisibleMessageIndex');    
  931.     msgs.method1('M_SetFirstVisibleMessageByIndex', current_first_message_element_index + 1);
  932.     
  933.     var MsgEvenness = G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
  934.     G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = 1 - MsgEvenness;
  935.     var new_last_message_element = document.createElement('tbody');
  936.     collection_container.appendChild(new_last_message_element);
  937.     BuildMessageAsObject(new_last_message_element, CollectionID, new_on_page_last_msg_id, (MsgEvenness+CONST_MESSAGES_ON_PAGE)%2); 
  938.     //-----------------------
  939.     G_Collection_lock = false;
  940.     //-----------------------
  941.     AutoRefreshScrollers(G_ActiveAssocID, CollectionID);
  942. }
  943. //    --------------------------------------------------------------------------
  944. //
  945. //    --------------------------------------------------------------------------
  946.  
  947. function go_prev_message(CollectionID)           
  948. {
  949.     G_Collection_lock = true;
  950.     //-----------------------
  951.     var collection_container = document.all[CollectionID+'_container']; 
  952.      if(collection_container == null) { G_Collection_lock = false; return;}
  953.     //-----------------------------------------------------------------------------
  954.     var msgs = external.ObjByID(CollectionID);    
  955.     var first_visible_msg_id  = msgs.Method0('M_GetFirstVisibleMessage').objID;
  956.     var first_msg_id  = msgs.GetFirst().objID;
  957.     if (first_visible_msg_id == first_msg_id) { G_Collection_lock = false; return;}
  958.     //-----------------------------------------------------------------------------    
  959.     var msgs_count = collection_container.children.length;
  960.     var MsgID = collection_container.children(msgs_count - 1).id;
  961.     var message_container_element = collection_container.all[MsgID];
  962.     if (message_container_element)     message_container_element.removeNode(true);    
  963.     //-----------------------------------------------------------------------------------------
  964.     var new_first_msg_index     = msgs.Method0('M_GetFirstVisibleMessageIndex') - 1; 
  965.     msgs.method1('M_SetFirstVisibleMessageByIndex', new_first_msg_index);
  966.     //-----------------------------------------------------------------------------------------
  967.     var new_first_msg_id         = msgs.Method0('M_GetFirstVisibleMessage').objID;
  968.     //-----------------------------------------------------------------------------------------
  969.     var new_first_msg_evenness     = (G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness+1)%2;    
  970.     G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = new_first_msg_evenness;
  971.     //-----------------------------------------------------------------------------------------
  972.     var new_first_msg_element     = document.createElement('tbody');
  973.     collection_container.insertBefore(new_first_msg_element, collection_container.children(0));
  974.     BuildMessageAsObject(new_first_msg_element, CollectionID, new_first_msg_id, new_first_msg_evenness); 
  975.     //-----------------------------------------------------------------------------------------    
  976.     G_Collection_lock = false;
  977.     //-----------------------
  978.     AutoRefreshScrollers(G_ActiveAssocID, CollectionID);    
  979. }
  980. //    --------------------------------------------------------------------------
  981. //
  982. //    --------------------------------------------------------------------------
  983. function go_first_page(CollectionID)
  984.     {
  985.     G_Collection_lock = true;
  986.     //-----------------------
  987.     var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  988.     msgs.Method1('M_SetFirstVisibleMessageByIndex', 0);
  989.     G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = 1;
  990.     G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID); 
  991.     //-----------------------
  992.     G_Collection_lock = false;
  993.     }    
  994. //    --------------------------------------------------------------------------
  995. //
  996. //    --------------------------------------------------------------------------        
  997. function go_last_page(CollectionID)
  998.     {    
  999.     G_Collection_lock = true;
  1000.     //-----------------------
  1001.     var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  1002.     var msg_count = msgs.Method0('M_GetCount');
  1003.     var page_size = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  1004.     var    msg_index = msg_count - page_size;     //alert(msg_index);// (R)    
  1005.     if (msg_index < 0)    msg_index = 0;
  1006.     //-----------------------------------------        
  1007.     msgs.Method1('M_SetFirstVisibleMessageByIndex', msg_index); //alert(msgs.Method0('M_GetFirstVisibleMessage')));
  1008.     G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = 1;
  1009.     G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);     
  1010.     //------------------------
  1011.     G_Collection_lock = false;                
  1012.     }    
  1013. //    --------------------------------------------------------------------------
  1014. //
  1015. //    --------------------------------------------------------------------------
  1016. function go_prev_page(CollectionID)           
  1017. {
  1018.     G_Collection_lock = true;
  1019.     //-----------------------
  1020.     var control_element = window.event.srcElement;
  1021.     var AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  1022.     var collection_container = AssocElement.all[CollectionID+'_container']; 
  1023.      if(collection_container == null) return;            
  1024.      //----------------------------------------------------------------------------------------
  1025.     var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  1026.     //----------------------------------------------------------------------------------------                                                        
  1027.     var msg = msgs.Method0('M_GetFirstVisibleMessage');        
  1028.     var msg_index = msgs.Method0('M_GetFirstVisibleMessageIndex');
  1029.     var    page_size = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  1030.  
  1031.     if (msg_index < page_size) msg_index = 0;
  1032.     else                        msg_index = msg_index - page_size;    
  1033.     //----------------------------------------------------------------------------        
  1034.     msgs.Method1('M_SetFirstVisibleMessageByIndex', msg_index);
  1035.     var MsgEvenness = G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
  1036.     G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = (MsgEvenness+page_size)%2;
  1037.     G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID); 
  1038.     //-----------------------
  1039.     G_Collection_lock = false;                    
  1040. }
  1041. //    --------------------------------------------------------------------------
  1042. //
  1043. //    --------------------------------------------------------------------------
  1044. function go_next_page(CollectionID)           
  1045. {
  1046.     G_Collection_lock = true;
  1047.     //-----------------------
  1048.     var control_element = window.event.srcElement;
  1049.     var AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  1050.     var collection_container = AssocElement.all[CollectionID+'_container']; 
  1051.      if(collection_container == null) return;            
  1052.      //----------------------------------------------------------------------------------------
  1053.     var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  1054.     //----------------------------------------------------------------------------------------                                                        
  1055.     var msg = msgs.Method0('M_GetFirstVisibleMessage');        
  1056.     var msg_index = msgs.Method0('M_GetFirstVisibleMessageIndex');
  1057.     if (msg != null) var lastVisibleMsg = msg;
  1058.     while (msg != null)    
  1059.         {
  1060.         msg = msgs.Method1('M_GetNextVisibleMessage', msg);
  1061.         if (msg != null) { lastVisibleMsg = msg; msg_index++;}            
  1062.         }                
  1063.     //----------------------------------------------------------------------------------------
  1064.     var firstVisibleMsg = msgs.GetNext(lastVisibleMsg); 
  1065.                                                             
  1066.     if (firstVisibleMsg != null)
  1067.         {
  1068.         msg_index++;
  1069.         msg_count = msgs.Method0('M_GetCount');
  1070.         page_size = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  1071.         if (msg_index + page_size >= msg_count)    msg_index = msg_count - page_size;
  1072.         //----------------------------------------------------------------------------        
  1073.         msgs.Method1('M_SetFirstVisibleMessageByIndex', msg_index);
  1074.         MsgEvenness = G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
  1075.         G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = (MsgEvenness+page_size)%2;
  1076.         G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);                     
  1077.         }
  1078.     //-----------------------
  1079.     G_Collection_lock = false;
  1080. }
  1081. //    --------------------------------------------------------------------------
  1082. //
  1083. //    --------------------------------------------------------------------------
  1084. function CreateScrollControls(direction, if_active, CollectionID, MsgScrollersExist)
  1085.     {
  1086.     if(!MsgScrollersExist)
  1087.         {
  1088.         this.msg     = '<img src="Pics/Dot.gif">';    this.page     = '<img src="Pics/Dot.gif">';    this.end     = '<img src="Pics/Dot.gif">';        
  1089.         this.top_msg = '<img src="Pics/Dot.gif">';    this.top_page = '<img src="Pics/Dot.gif">';    this.top_end = '<img src="Pics/Dot.gif">';        
  1090.         this.scroll  = '<img src="Pics/Dot.gif">';        
  1091.         return this;
  1092.         }
  1093.         
  1094.     if(direction == 'next')
  1095.         {
  1096.         dir1 = 'next';
  1097.         dir2 = 'Next';
  1098.         dir3 = 'last';
  1099.         dir4 = 'Last';
  1100.         var v_border = 'border-right:solid 1px #787864;';
  1101.         }
  1102.         else
  1103.         {
  1104.         dir1 = 'prev';
  1105.         dir2 = 'Prev';
  1106.         dir3 = 'first';
  1107.         dir4 = 'First';
  1108.         var v_border = 'border-left:solid 1px #787864;';
  1109.         }
  1110.     var border_style = 'style="margin-left: 1px;"';//'style="border-top:solid 1px #787864; border-bottom:solid 1px #787864;"';
  1111.     var border_style_brink = 'style="margin-left: 1px;"'; //'style="border-top:solid 1px #787864; border-bottom:solid 1px #787864; '+v_border+'"';
  1112.     if(if_active == true)
  1113.         {
  1114.         this.msg = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir1+'_message(\''+CollectionID+'\');" ondblclick="go_'+dir1+'_message(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" onmouseup="ScrollControlUp(this)" src="Pics/'+dir2+'Message.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_message")+'">';
  1115.         this.page = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir1+'_page(\''+CollectionID+'\');" ondblclick="go_'+dir1+'_page(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" src="Pics/'+dir2+'Page.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_page")+'">';
  1116.         this.end = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir3+'_page(\''+CollectionID+'\');" ondblclick="go_'+dir3+'_page(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" src="Pics/To'+dir4+'.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir3+"_page")+'">';
  1117.         
  1118.         this.top_msg = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir1+'_message(\''+CollectionID+'\');" ondblclick="go_'+dir1+'_message(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" onmouseup="ScrollControlUp(this)" src="Pics/'+dir2+'Message.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_message")+'" '+border_style+'>';
  1119.         this.top_page = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir1+'_page(\''+CollectionID+'\');" ondblclick="go_'+dir1+'_page(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" src="Pics/'+dir2+'Page.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_page")+'" '+border_style+'>';
  1120.         this.top_end = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir3+'_page(\''+CollectionID+'\');" ondblclick="go_'+dir3+'_page(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" src="Pics/To'+dir4+'.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir3+"_page")+'" '+border_style_brink+'>';
  1121.         }
  1122.         else
  1123.         {
  1124.         this.msg = '<img src="Pics/'+dir2+'Message_gray.gif" >';
  1125.         this.page = '<img src="Pics/'+dir2+'Page_gray.gif" >';
  1126.         this.end = '<img src="Pics/To'+dir4+'_gray.gif">';
  1127.         
  1128.         this.top_msg = '<img src="Pics/'+dir2+'Message_gray.gif"  '+border_style+'>';
  1129.         this.top_page = '<img src="Pics/'+dir2+'Page_gray.gif"  '+border_style+'>';
  1130.         this.top_end = '<img src="Pics/To'+dir4+'_gray.gif" '+border_style_brink+'>';
  1131.         }
  1132.         
  1133. //----------------------------------------------------------------------------------------------------------------------------------------------------
  1134. // scrolling block begin
  1135. //----------------------------------------------------------------------------------------------------------------------------------------------------
  1136.     {    
  1137.     var collection_message_list = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  1138.     var message_counter_value   = collection_message_list.Method0('M_GetCount');    //alert(message_counter_value);    
  1139.     //----------------------------------------------------------------------------------------------------
  1140.     if (msgIndex == null) var top_message_index = collection_message_list.method0('M_GetFirstVisibleMessageIndex');        
  1141.     else                   var top_message_index = msgIndex;     //alert(collection_message_list.method0('M_GetFirstVisibleMessageIndex') +'  '+ msgIndex);
  1142.     //----------------------------------------------------------------------------------------------------
  1143.     var bar_container_height = Math.round(100*(CONST_MESSAGES_ON_PAGE/10) + (CONST_MESSAGES_ON_PAGE/10 - 1) * 90) - 7;    
  1144.     if ((message_counter_value <= CONST_MESSAGES_ON_PAGE)) var factor = 0;
  1145.     else                                                   var factor = (top_message_index)/(message_counter_value - CONST_MESSAGES_ON_PAGE); 
  1146.     //alert((top_message_index) + '/(' + message_counter_value + '-' + CONST_MESSAGES_ON_PAGE + ')');
  1147.     var scroll_bar_y             = factor*(bar_container_height - 15); 
  1148.     scroll_bar_y                 = Math.round(scroll_bar_y);
  1149.     //----------------------------------                                      
  1150.     this.scroll =    '<div style="position: relative; height:' + bar_container_height + ';">' +
  1151.                         '<div id="'+CollectionID+'BarWrapContainer" ' + ' collectionID="'+CollectionID+'" ' +
  1152.                          'style="position: absolute; z-index:0; width:16px; height:' + bar_container_height + '; top:0; left:0; '+ 
  1153.                          'background:url(\'Pics/ScrBar_ground.gif\'); background-repeat:repeat-y; background-position:top left;">' + 
  1154.                             '<div id="'+CollectionID+'BarWrap" class="draggable" collectionID="' + CollectionID + '"' + 
  1155.                              'style="position: absolute; left:0; top:' + scroll_bar_y + '; width: 16px; height:15px; border: solid black 0px; z-index:0;">' +
  1156.                                 '<img id="'+CollectionID+'Bar" name="' + CollectionID + 'Bar" ' +
  1157.                                   ' src="Pics/ScrBar.gif" width="16px" height="15px" border="0" style="cursor: hand;" '+
  1158.                                   ' onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)">' +
  1159.                             '</div>' +
  1160.                         '</div>' + 
  1161.                     '</div>';
  1162.     }
  1163. //----------------------------------------------------------------------------------------------------------------------------------------------------
  1164. // scrolling block end
  1165. //----------------------------------------------------------------------------------------------------------------------------------------------------
  1166.     return this;
  1167.     }
  1168.  
  1169. //    --------------------------------------------------------------------------
  1170. //
  1171. //    --------------------------------------------------------------------------
  1172.  
  1173. function RefreshMsgScrollers(AssocElement, direction, if_active, CollectionID, MsgScrollersExist)
  1174.     {
  1175.     var collection_scrollbar = AssocElement.all[CollectionID+'_ScrollBar'];
  1176.     if (collection_scrollbar == null) return;
  1177.     var collection_top_scrollbar = AssocElement.all[CollectionID+'_in'];
  1178.     var Scroll_controls = new CreateScrollControls(direction, if_active, CollectionID, MsgScrollersExist);
  1179.     if(direction == 'next')
  1180.         {
  1181.         dir2 = 'Next';
  1182.         }
  1183.         else
  1184.         {
  1185.         dir2 = 'Prev';
  1186.         }
  1187.     collection_scrollbar.all[dir2+'_msg'].innerHTML = Scroll_controls.msg;
  1188.     collection_scrollbar.all[dir2+'_page'].innerHTML = Scroll_controls.page;
  1189.     collection_scrollbar.all[dir2+'_end'].innerHTML = Scroll_controls.end;    
  1190.     collection_scrollbar.all['Scroll_all'].innerHTML = Scroll_controls.scroll;    
  1191.     collection_top_scrollbar.all['Top'+dir2+'_msg'].innerHTML = Scroll_controls.top_msg;
  1192.     collection_top_scrollbar.all['Top'+dir2+'_page'].innerHTML = Scroll_controls.top_page;
  1193.     collection_top_scrollbar.all['Top'+dir2+'_end'].innerHTML = Scroll_controls.top_end;
  1194.     }
  1195. //-------------------------------------------------------------------------------------------------
  1196. function ScrollControlHi(control_element)
  1197.     {
  1198.     var control_src = control_element.src;
  1199.     if(control_src == null)    return;
  1200.     control_element.src = control_src.replace(/.gif/,"_hi.gif");
  1201.     }
  1202.  
  1203. function ScrollControlUsual(control_element)
  1204.     {
  1205.     var control_src = control_element.src;
  1206.     if(control_src == null)    return;
  1207.     control_element.src = control_src.replace(/(_hi)?.gif/,".gif");
  1208.     }
  1209.     
  1210. function ScrollControlUp(control_element)
  1211.     {
  1212.     var control_src = control_element.src;
  1213.     if(control_src == null)    return;
  1214.     control_element.src = control_src.replace(/(_hi)?.gif/,"_hi.gif");
  1215.     }
  1216.     
  1217. function ScrollControlDown(control_element)
  1218.     {
  1219.     if(control_element             == null )    return;
  1220.     if(control_element.tagName     != 'IMG')    return;
  1221.     
  1222.     var control_src = control_element.src;    // Error 1152 occurred at 1-5-2
  1223.     if(control_src                 == null )    return;
  1224.     control_element.src = control_src.replace(/(_hi)?.gif/,".gif");
  1225.     }
  1226. //-------------------------------------------------------------------------------------------------
  1227. function ExtCountersRefresh(CollectionID, Counter)
  1228.     {
  1229.     CounterRefresh(G_ActiveAssocID, CollectionID, Counter);    
  1230.     if (G_Collection_lock == false) {AutoRefreshScrollers(G_ActiveAssocID, CollectionID);}    
  1231.     }
  1232. //-------------------------------------------------------------------------------------------------
  1233. function CounterRefresh(AssocID, CollectionID, Counter)
  1234.     {    
  1235.     var collection = G_Assocs[AssocID].TreeView._collections[CollectionID]; 
  1236.     if (collection) { var collection_message_list = G_Assocs[AssocID].TreeView._collections[CollectionID].obj;}
  1237.     else            { var collection_message_list = null;}
  1238.     
  1239.     if(collection_message_list != null)
  1240.         {
  1241.         var collection_node       = G_Assocs[AssocID].TreeView.root._children[CollectionID];
  1242.         //-----------------------------------------------------------------------------------------------------
  1243.         // if it is required collection initialization in GUI
  1244.         //-----------------------------------------------------------------------------------------------------        
  1245.         if((collection_node._empty == true) && (collection_node._expanded == false))
  1246.             {                
  1247.             collection_node._empty = false; 
  1248.             collection_node._first_disp_msg_evenness = 1;
  1249.             G_Assocs[AssocID].TreeView.redraw_collection(CollectionID);        
  1250.             }
  1251.         if (Counter == 0)    G_Assocs[AssocID].TreeView.redraw_collection(CollectionID);    
  1252.         //-----------------------------------------------------------------------------------------------------
  1253.         //    counter refreshing
  1254.         //-----------------------------------------------------------------------------------------------------
  1255.         var association_element         = document.getElementById('Assoc_'+AssocID);            
  1256.         var collection_caption_element  = association_element.all[CollectionID+'_caption'];        
  1257.         if (collection_caption_element) collection_caption_element.innerHTML = Counter;            
  1258.         }    
  1259.     }
  1260. //-------------------------------------------------------------------------------------------------    
  1261. function FillMsgNode(MsgObj, MsgEvenness, CollectionID) 
  1262.     {
  1263.     var msg_html = '';
  1264.     
  1265.     if(MsgEvenness == 0) {    var TbodyClass = "Msg_Even";     }
  1266.     else                 {    var TbodyClass = "Msg_Odd";        }
  1267.     
  1268.     if(MsgObj.IsSyncItemMsg())
  1269.         {
  1270.         //------------------------------------------------------
  1271.         solution = MsgObj.GetObjM('m_SolutionWPtr');
  1272.         if(solution == null) 
  1273.             {
  1274.             alert("solution == null");
  1275.             return '';
  1276.             }
  1277.         //------------------------------------------------------
  1278.         var WinningTreeID = solution.Method0('M_GetWinningActionAsID'); //DU solution.GetM('MM_WinningTreeID'); 
  1279.         if(WinningTreeID == CONST_WIN_NO_SYNC)
  1280.             {
  1281.             Radio_dont_sync = 'true';
  1282.             Radio_del_sync = 'false';
  1283.             }
  1284.         else if(WinningTreeID == CONST_WIN_DEL_SYNC)//DELL_ALL
  1285.                 {
  1286.                 Radio_dont_sync = 'false';
  1287.                 Radio_del_sync = 'true';
  1288.                 }
  1289.              else 
  1290.                 {
  1291.                 Radio_dont_sync = 'false';
  1292.                 Radio_del_sync = 'false';
  1293.                 }    
  1294.         //------------------------------------------------------
  1295.         var AssocObj = MsgObj.GetM('m_SlnDoAssocSyncWPtr');
  1296.         var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  1297.         var SolutionActionState = solution.Method0('M_GetActionState');//DU solution.GetM('MM_ActionState'); 
  1298.         if(SolutionActionState == CONST_ACTION_STATE_INIT) //ACTION_STATE_INIT
  1299.             {
  1300.             var Menu_handler = 'onmouseenter="ShowFM()" onmouseleave="HideFM()" onclick=OnPopupClick() oncontextmenu="StopContextMenu()" msg_id="'+MsgObj.objID+'" collection_id="'+CollectionID+'"';
  1301.             var If_gray = '';
  1302.             var Progress = '';
  1303.             if (solution.Method0('M_GetAvailableItemForSynchronization') == false) 
  1304.                 {
  1305.                 Menu_handler = '';
  1306.                 If_gray = '_gray';
  1307.                 var Progress = '';
  1308.                 }
  1309.             }
  1310.         else if(SolutionActionState == CONST_ACTION_STATE_IN_PROGRESS) //ACTION_STATE_IN_PROGRESS
  1311.                 {
  1312.                 var Menu_handler = '';
  1313.                 var If_gray = '';
  1314.                 var Progress = '_progressed';                
  1315.                 }
  1316.              else if(SolutionActionState == CONST_ACTION_STATE_DONE) //ACTION_STATE_DONE
  1317.                      {
  1318.                      var Menu_handler = '';
  1319.                      var If_gray = '_gray';
  1320.                      var Progress = '';
  1321.                      }
  1322.                   else
  1323.                      {
  1324.                      alert('FillMsgNode3: SolutionActionState == '+SolutionActionState+' is out of range');
  1325.                      }
  1326.         //-------------------------------------------------------------------    
  1327.         SyncTreeArray = new Array();
  1328.         var i = 0;
  1329.         var Missing_active = false;        
  1330.         var SuperTree_Obj = SuperTreeList.GetFirst();
  1331.         while(SuperTree_Obj != null)
  1332.             {
  1333.             SyncTreeArray[i] = {};
  1334.             SyncTree_Obj = SuperTree_Obj.GetFirst();
  1335.             SyncTreeArray[i].obj = SyncTree_Obj;
  1336.             SyncTreeArray[i].id = SuperTree_Obj.objID; //DU SyncTree_Obj.GetM('MM_TreeID');
  1337.             SyncTreeArray[i].file_name = solution.Method1('M_CreateFullPathStrBySuperTree', SuperTree_Obj); //DU Method1ID('M_CreateFullPathStrByTreeID', SyncTreeArray[i].id);
  1338.             SyncTreeArray[i].SyncItemCharacteristics = new CreateSyncItemCharacteristics(solution, SuperTree_Obj, CollectionID);
  1339.             //--------------------------------------------------------------------------------
  1340.             if((WinningTreeID != CONST_WIN_NO_SYNC) && ((WinningTreeID != CONST_WIN_DEL_SYNC)))
  1341.                 {
  1342.                 if(SyncTreeArray[i].id == WinningTreeID)
  1343.                     {                    
  1344.                     SyncTreeArray[i].arrow_direction = 'out'+If_gray+Progress;
  1345.                     SyncTreeArray[i].radio = 'active'; 
  1346.                     SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1347.                                         
  1348.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_missing == true)
  1349.                         {
  1350.                         Missing_active = true;
  1351.                         }                    
  1352.                     }
  1353.                 else // item is not a winner
  1354.                     {
  1355.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1356.                         {                        
  1357.                         SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1358.                         SyncTreeArray[i].radio = 'unactive';
  1359.                         SyncTreeArray[i].radio_handler ='';
  1360.                         }                
  1361.                     else
  1362.                         {
  1363.                         SyncTreeArray[i].arrow_direction = 'in'+If_gray+Progress;
  1364.                         SyncTreeArray[i].radio = 'unactive';
  1365.                         SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1366.                         }
  1367.                     }
  1368.                 }
  1369.             else if (WinningTreeID == CONST_WIN_NO_SYNC)
  1370.                     {
  1371.                     SyncTreeArray[i].arrow_direction = 'no'+If_gray+Progress;
  1372.                     SyncTreeArray[i].radio = 'unactive';                    
  1373.                     SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1374.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_available == false) 
  1375.                         {
  1376.                         SyncTreeArray[i].radio_handler ='';
  1377.                         SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1378.                         }
  1379.                     }
  1380.                  else if (WinningTreeID == CONST_WIN_DEL_SYNC)
  1381.                     {
  1382.                     SyncTreeArray[i].arrow_direction = 'no'+If_gray+Progress;
  1383.                     SyncTreeArray[i].radio = 'unactive';
  1384.                     SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1385.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_available == false) 
  1386.                         {
  1387.                         SyncTreeArray[i].radio_handler ='';
  1388.                         SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1389.                         }
  1390.                     }
  1391.  
  1392.             SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  1393.             i++;
  1394.             }
  1395.         //---------------------------------------------------------------------------
  1396.         var SyncTreeList_length = i;
  1397.         if(Missing_active == true)
  1398.             {
  1399.             for(i=0; i<SyncTreeList_length; i++)
  1400.                  {
  1401.                  if(SyncTreeArray[i].arrow_direction == 'in'+If_gray+Progress)
  1402.                     {
  1403.                     SyncTreeArray[i].arrow_direction = 'del'+If_gray+Progress;
  1404.                     }
  1405.                 }
  1406.             }        
  1407.         //---------------------------------------------------------------------------
  1408.         if(WinningTreeID == CONST_WIN_DEL_SYNC)
  1409.             {
  1410.             for(i=0; i<SyncTreeList_length; i++)                                 
  1411.                 {
  1412.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1413.                     {
  1414.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';                                    
  1415.                     }
  1416.                 else
  1417.                     SyncTreeArray[i].arrow_direction = 'del'+If_gray+Progress;    
  1418.                 }    
  1419.             }
  1420.         //---------------------------------------------------------------------------
  1421.         // New!
  1422.         if(WinningTreeID == CONST_WIN_NO_SYNC)
  1423.             {            
  1424.             for(i=0; i<SyncTreeList_length; i++) 
  1425.                 {
  1426.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1427.                     {
  1428.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';                    
  1429.                     }
  1430.                 else
  1431.                     SyncTreeArray[i].arrow_direction = 'no'+If_gray+Progress;                                    
  1432.                 }                                    
  1433.             }    
  1434.         //---------------------------------------------------------------------------
  1435.         var Gray0 = '';
  1436.         var Gray1 = '';
  1437.         
  1438.         if (SyncTreeArray[0].SyncItemCharacteristics.if_available == false) Gray0 = '_gray';        
  1439.         if (SyncTreeArray[1].SyncItemCharacteristics.if_available == false) Gray1 = '_gray';    
  1440.         
  1441.         if (SyncTreeList_length == 2)
  1442.             {
  1443.             msg_html    =    '<tbody id="'+MsgObj.objID+'" class="'+TbodyClass+'" if_dont_sync="'+Radio_dont_sync+
  1444.                             '" if_del_sync="'+Radio_del_sync+'" msg_type="2" exist="true" oncontextmenu="OnMsgContextMenu()">'+
  1445.                             '<tr class="Single_row">'+                    
  1446.                             //-------------------------------------------------------------------------
  1447.                             CreateSyncItemCharacteristicsHTML(SyncTreeArray[0].SyncItemCharacteristics)+                    
  1448.                             //-------------------------------------------------------------------------
  1449.                             '<td class="Left_cell" '+Menu_handler+'>'+
  1450.                             '<img src="Pics/Radio_left_'+SyncTreeArray[0].radio+Gray0+'.gif" '+
  1451.                             'title="'+external.LS('hint_Winner')+'" '+
  1452.                             'class="Radio_control" '+SyncTreeArray[0].radio_handler+'></td>'+
  1453.                             //-------------------------------------------------------------------------
  1454.                             '<td height="100%" '+Menu_handler+'>'+
  1455.                             '<div id="Base_'+MsgObj.objID+'" class="Back_plate"><div class="Arrow_left_'+SyncTreeArray[0].arrow_direction+'"></div></div></td>'+
  1456.                             //-------------------------------------------------------------------------
  1457.                               '<td height="100%" '+Menu_handler+'>'+
  1458.                               '<div class="Back_plate"><div class="Arrow_mid_single'+If_gray+'"></div></div></td>'+    
  1459.                             //-------------------------------------------------------------------------
  1460.                             '<td height="100%" '+Menu_handler+'>'+
  1461.                             '<div class="Back_plate"><div class="Arrow_right_'+SyncTreeArray[1].arrow_direction+'"></div></div></td>'+        
  1462.                             //-------------------------------------------------------------------------
  1463.                             '<td class="Right_cell" '+Menu_handler+'>'+
  1464.                                 '<img src="Pics/Radio_right_'+SyncTreeArray[1].radio+Gray1+'.gif" '+
  1465.                                 'title="'+external.LS('hint_Winner')+'" '+
  1466.                                 'class="Radio_control" '+SyncTreeArray[1].radio_handler+'></td>'+
  1467.                             //-------------------------------------------------------------------------
  1468.                             CreateSyncItemCharacteristicsHTML(SyncTreeArray[1].SyncItemCharacteristics)+
  1469.                             //-------------------------------------------------------------------------
  1470.                               '</tr>'+
  1471.                             '</tbody>'; 
  1472.             }            
  1473.         if (SyncTreeList_length > 2)        
  1474.             {
  1475.             msg_html    =    '<tbody id="'+MsgObj.objID+'" class="'+TbodyClass+'" if_dont_sync="'+Radio_dont_sync+
  1476.                             '" if_del_sync="'+Radio_del_sync+'" msg_type="3" exist="true" oncontextmenu="OnMsgContextMenu()">';
  1477.             //First row
  1478.             msg_html   +=    '<tr class="First_row">'+CreateSyncItemCharacteristicsHTML(SyncTreeArray[0].SyncItemCharacteristics)+ 
  1479.                             '<td class="Left_cell" '+Menu_handler+'>'+
  1480.                             '<img src="Pics/Radio_left_'+SyncTreeArray[0].radio+Gray0+'.gif" '+
  1481.                             'title="'+external.LS('hint_Winner')+'" '+
  1482.                             'class="Radio_control" '+SyncTreeArray[0].radio_handler+'></td>'+
  1483.                             '<td height="100%" '+Menu_handler+'>'+
  1484.                             '<div class="Back_plate"><div class="Arrow_left_'+SyncTreeArray[0].arrow_direction+'"></div></div></td>'+
  1485.                             '<td height="100%" '+Menu_handler+'>'+
  1486.                             '<div id="Base_up_'+MsgObj.objID+'" class="Back_plate"><div class="Arrow_mid_top'+If_gray+'"></div></div></td>'+
  1487.                             '<td '+Menu_handler+'><div class="Back_plate">'+ 
  1488.                               '<div class="Arrow_right_'+SyncTreeArray[1].arrow_direction+'"></div></div></td>'+
  1489.                             '<td class="Right_cell" '+Menu_handler+'>'+
  1490.                             '<img src="Pics/Radio_right_'+SyncTreeArray[1].radio+Gray1+'.gif" '+                            
  1491.                             'title="'+external.LS('hint_Winner')+'" '+
  1492.                             'class="Radio_control" '+SyncTreeArray[1].radio_handler+'></td>'+
  1493.                             CreateSyncItemCharacteristicsHTML(SyncTreeArray[1].SyncItemCharacteristics)+'</tr>';
  1494.             //Middle rows
  1495.             for(i=2; i<SyncTreeList_length-1; i++)    
  1496.                 {
  1497.                 var Gray = '';
  1498.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false) Gray = '_gray';    
  1499.             
  1500.                 msg_html    +=    '<tr class="Mid_row">'+    CreateSyncItemCharacteristicsHTML(null)+ 
  1501.                                 '<td class="Left_cell" '+Menu_handler+'>'+'</td>'+
  1502.                                 '<td height="100%" '+Menu_handler+'>'+'<div class="Back_plate"></div></td>'+
  1503.                                 '<td height="100%" '+Menu_handler+'>'+'<div class="Back_plate"><div class="Arrow_mid_mid'+If_gray+'"></div></div></td>'+
  1504.                                 '<td '+Menu_handler+'><div class="Back_plate">'+ '<div class="Arrow_right_'+SyncTreeArray[i].arrow_direction+'"></div></div></td>'+
  1505.                                 '<td class="Right_cell" '+Menu_handler+'>'+
  1506.                                 '<img src="Pics/Radio_right_'+SyncTreeArray[i].radio+Gray+'.gif" '+
  1507.                                 'title="'+external.LS('hint_Winner')+'" '+
  1508.                                 'class="Radio_control" '+SyncTreeArray[i].radio_handler+'></td>'+
  1509.                                 CreateSyncItemCharacteristicsHTML(SyncTreeArray[i].SyncItemCharacteristics)+'</tr>';
  1510.                 }
  1511.             //Last row
  1512.             var Gray = '';
  1513.             if (SyncTreeArray[SyncTreeList_length-1].SyncItemCharacteristics.if_available == false) Gray = '_gray';    
  1514.         
  1515.             msg_html    +=    '<tr class="Last_row">'+CreateSyncItemCharacteristicsHTML(null)+ 
  1516.                             '<td class="Left_cell" '+Menu_handler+'>'+'</td>'+
  1517.                             '<td height="100%" '+Menu_handler+'>'+'<div class="Back_plate"></div></td>'+
  1518.                             '<td height="100%" '+Menu_handler+'>'+'<div id="Base_down_'+MsgObj.objID+
  1519.                             '" class="Back_plate"><div class="Arrow_mid_bottom'+If_gray+'"></div></div></td>'+
  1520.                             '<td '+Menu_handler+'><div class="Back_plate">'+ 
  1521.                               '<div class="Arrow_right_'+SyncTreeArray[SyncTreeList_length-1].arrow_direction+'"></div></div></td>'+
  1522.                             '<td class="Right_cell" '+Menu_handler+'>'+
  1523.                             '<img id="radio_left" src="Pics/Radio_right_'+SyncTreeArray[SyncTreeList_length-1].radio+Gray+'.gif" '+
  1524.                             'title="'+external.LS('hint_Winner')+'" '+
  1525.                             'class="Radio_control" '+
  1526.                             SyncTreeArray[SyncTreeList_length-1].radio_handler+'></td>'+
  1527.                             CreateSyncItemCharacteristicsHTML(SyncTreeArray[SyncTreeList_length-1].SyncItemCharacteristics)+'</tr>';                
  1528.             msg_html    +=    '</tbody>';
  1529.             }
  1530.         return msg_html; 
  1531.         }
  1532.     else    // Message is not sync item 
  1533.         {        
  1534.         var itemId_in_sync_item_collection = MsgObj.Method0('M_GetLinkID');        
  1535.         var link_to_sync_item = '';
  1536.         if(CONST_CID != itemId_in_sync_item_collection)    
  1537.             {        
  1538.             link_to_sync_item = '';
  1539.                                 //'<span style="cursor:hand; color:blue; margin-left:15px; text-decoration: underline;" '+
  1540.                                 //'onmouseover="OnMouseOverPath()" onmouseout="OnMouseOutPath()" '+
  1541.                                 //'onclick=LinkToCollectionMsg("All","'+itemId_in_sync_item_collection+'")>'+
  1542.                                 //external.LS('tooltip_goto_sync_item')+'</span>';
  1543.             }                    
  1544.  
  1545.         msg_html    =    '<tbody id="'+MsgObj.objID+'" class="'+TbodyClass+'" exist="true" oncontextmenu="OnMsgContextMenu()"><tr class="Single_row">'+
  1546.                         '<td colspan="11" class="info_msg">'+ 
  1547.                            '<span id="Link'+CollectionID+MsgObj.objID+'"></span>'+
  1548.                            MsgObj.ToString()+                        
  1549.                         CreateMsgButtons(MsgObj)+
  1550.                         link_to_sync_item+
  1551.                         '</td></tr></tbody>';
  1552.         return msg_html;
  1553.         }
  1554.     }
  1555.  
  1556. function BuildMessageAsObject(message_tbody_element, CollectionID, MessageID, MsgEvenness)
  1557. {
  1558.     if(MsgEvenness == 0)        TbodyClass = "Msg_Even";
  1559.     else                        TbodyClass = "Msg_Odd";
  1560.         
  1561.     var MsgObj = external.ObjByID(MessageID);
  1562.     var AssocObj    = MsgObj.GetM('m_SlnDoAssocSyncWPtr');
  1563.     var AssocID = AssocObj.objID;
  1564.     message_tbody_element.id = MessageID;
  1565.     message_tbody_element.className = TbodyClass;
  1566.     message_tbody_element.oncontextmenu = OnMsgContextMenu;
  1567.     //--------------------------------------------------------------------
  1568.     var tbody_length = message_tbody_element.rows.length;
  1569.     for(i=0; i<tbody_length; i++)    message_tbody_element.deleteRow();
  1570.     //--------------------------------------------------------------------    
  1571. if(MsgObj.IsSyncItemMsg())
  1572.     {
  1573.         solution = MsgObj.GetObjM('m_SolutionWPtr');
  1574.         if(solution == null) 
  1575.             {
  1576.             alert("solution == null");
  1577.             return "";
  1578.             }
  1579.         //-------------------------------------------------------------    
  1580.         var WinningTreeID = solution.Method0('M_GetWinningActionAsID'); //DU solution.GetM('MM_WinningTreeID'); 
  1581.         if(WinningTreeID == CONST_WIN_NO_SYNC)
  1582.             {
  1583.             Radio_dont_sync = 'true';
  1584.             Radio_del_sync = 'false';
  1585.             }
  1586.         else if (WinningTreeID == CONST_WIN_DEL_SYNC)
  1587.                 {
  1588.                 Radio_dont_sync = 'false';
  1589.                 Radio_del_sync = 'true';
  1590.                 }
  1591.             else
  1592.                 {
  1593.                 Radio_dont_sync = 'false';
  1594.                 Radio_del_sync = 'false';
  1595.                 }
  1596.         //-------------------------------------------------------------
  1597.         var AssocObj = MsgObj.GetM('m_SlnDoAssocSyncWPtr');
  1598.         var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  1599.         var SolutionActionState = solution.Method0('M_GetActionState');//DU solution.GetM('MM_ActionState'); 
  1600.         if(SolutionActionState == CONST_ACTION_STATE_INIT) //ACTION_STATE_INIT
  1601.             {
  1602.             var Menu_handlers_on = true;
  1603.             var If_gray = '';
  1604.             var Progress = '';                        
  1605.             }
  1606.         else if(SolutionActionState == CONST_ACTION_STATE_IN_PROGRESS) //ACTION_STATE_IN_PROGRESS
  1607.                 {
  1608.                 var Menu_handlers_on = false;
  1609.                 var If_gray = '';
  1610.                 var Progress = '_progressed';
  1611.                 }
  1612.              else if(SolutionActionState == CONST_ACTION_STATE_DONE) //ACTION_STATE_DONE
  1613.                      {
  1614.                      var Menu_handlers_on = false;
  1615.                      var If_gray = '_gray';
  1616.                      var Progress = '';                     
  1617.                      }
  1618.                   else
  1619.                      {
  1620.                      alert('BuildMessageAsObject3: SolutionActionState == '+SolutionActionState+' is out of range');
  1621.                      }
  1622.         //-------------------------------------------------------------        
  1623.         SyncTreeArray = new Array();
  1624.         var i = 0;
  1625.         var Missing_active = false;
  1626.         SuperTree_Obj = SuperTreeList.GetFirst();
  1627.         while(SuperTree_Obj != null)
  1628.             {
  1629.             SyncTreeArray[i] = {};
  1630.             SyncTree_Obj = SuperTree_Obj.GetFirst();
  1631.             SyncTreeArray[i].obj = SyncTree_Obj;
  1632.             SyncTreeArray[i].id = SuperTree_Obj.objID; //DU SyncTree_Obj.GetM('MM_TreeID');
  1633.             SyncTreeArray[i].file_name = solution.Method1('M_CreateFullPathStrBySuperTree', SuperTree_Obj); //DU Method1ID('M_CreateFullPathStrByTreeID', SyncTreeArray[i].id);
  1634.             SyncTreeArray[i].SyncItemCharacteristics = new CreateSyncItemCharacteristics(solution, SuperTree_Obj, CollectionID);
  1635.             if((WinningTreeID != CONST_WIN_NO_SYNC) && (WinningTreeID != CONST_WIN_DEL_SYNC))
  1636.                 {
  1637.                 if(SyncTreeArray[i].id == WinningTreeID)
  1638.                     {
  1639.                     SyncTreeArray[i].arrow_direction = 'out'+If_gray+Progress;
  1640.                     SyncTreeArray[i].radio = 'active'; 
  1641.                     SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1642.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_missing == true)
  1643.                         {
  1644.                         Missing_active = true;
  1645.                         }
  1646.                     }
  1647.                 else // if item is not winner
  1648.                     {
  1649.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1650.                         {                        
  1651.                         SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1652.                         SyncTreeArray[i].radio = 'unactive';
  1653.                         SyncTreeArray[i].radio_handler ='';
  1654.                         }
  1655.                     else
  1656.                         {    
  1657.                         SyncTreeArray[i].arrow_direction = 'in'+If_gray+Progress;
  1658.                         SyncTreeArray[i].radio = 'unactive';
  1659.                         SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1660.                         }                        
  1661.                     }
  1662.                 }
  1663.             else
  1664.                 {            
  1665.                 SyncTreeArray[i].arrow_direction = 'no'+If_gray+Progress;
  1666.                 SyncTreeArray[i].radio = 'unactive';
  1667.                 SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1668.                 if(SyncTreeArray[i].SyncItemCharacteristics.if_available == false) 
  1669.                     {
  1670.                     SyncTreeArray[i].radio_handler = '';
  1671.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1672.                     }                                    
  1673.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_syncability == false) 
  1674.                     { 
  1675.                     SyncTreeArray[i].radio_handler = '';
  1676.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1677.                     Menu_handlers_on = false;
  1678.                     If_gray = '_gray';
  1679.                     }     
  1680.                 }
  1681.             SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  1682.             i++;
  1683.             }
  1684.         //-----------------------------------------------------------    
  1685.         var SyncTreeList_length = i;
  1686.         if(Missing_active == true)
  1687.             {
  1688.             for(i=0; i<SyncTreeList_length; i++)
  1689.                  {
  1690.                  if(SyncTreeArray[i].arrow_direction == 'in'+If_gray+Progress)
  1691.                     {
  1692.                     SyncTreeArray[i].arrow_direction = 'del'+If_gray+Progress;
  1693.                     }
  1694.                 }
  1695.             }
  1696.         //----------------------------------------------------------
  1697.         if(WinningTreeID == CONST_WIN_DEL_SYNC)
  1698.             {
  1699.             for(i=0; i<SyncTreeList_length; i++) 
  1700.                 {
  1701.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1702.                     {
  1703.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';                    
  1704.                     }
  1705.                 else
  1706.                     SyncTreeArray[i].arrow_direction = 'del'+If_gray+Progress;                
  1707.                 }                    
  1708.             }        
  1709.         //----------------------------------------------------------
  1710.         // New!
  1711.         if(WinningTreeID == CONST_WIN_NO_SYNC)
  1712.             {            
  1713.             for(i=0; i<SyncTreeList_length; i++) 
  1714.                 {
  1715.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1716.                     {
  1717.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';                    
  1718.                     }
  1719.                 else
  1720.                     SyncTreeArray[i].arrow_direction = 'no'+If_gray+Progress;                                    
  1721.                 }                                    
  1722.             }        
  1723.         //----------------------------------------------------------        
  1724.     if (SyncTreeList_length == 2)
  1725.         {
  1726.         message_tbody_element.if_dont_sync = Radio_dont_sync;
  1727.         message_tbody_element.if_del_sync = Radio_del_sync;
  1728.         message_tbody_element.msg_type = "2";
  1729.         message_tbody_element.exist = "true";
  1730.         
  1731.         var main_line_element = message_tbody_element.insertRow();
  1732.         main_line_element.className = 'Single_row';
  1733.         //----------------------------------------
  1734.         CreateSyncItemCharacteristicsTD(main_line_element, SyncTreeArray[0].SyncItemCharacteristics);
  1735.         //----------------------------------------
  1736.         Left_radio_element = main_line_element.insertCell();
  1737.         Left_radio_element.className = "Left_cell";
  1738.         //----------------------------------------
  1739.         Left_arrow_element = main_line_element.insertCell();
  1740.         Left_arrow_element.height = "100%";
  1741.         Left_arrow_element.innerHTML = '<div id="Base_'+MsgObj.objID+'" class="Back_plate"><div class="Arrow_left_'+SyncTreeArray[0].arrow_direction+'"></div></div>';
  1742.         //----------------------------------------
  1743.         Mid_arrow_element = main_line_element.insertCell();
  1744.         Mid_arrow_element.height = "100%";
  1745.         Mid_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_mid_single'+If_gray+'" ></div></div>'; 
  1746.         //----------------------------------------
  1747.         Right_arrow_element = main_line_element.insertCell();
  1748.         Right_arrow_element.height = "100%";
  1749.         Right_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_right_'+SyncTreeArray[1].arrow_direction+'"></div></div>';
  1750.         //----------------------------------------
  1751.         Right_radio_element = main_line_element.insertCell();
  1752.         Right_radio_element.className = "Right_cell";
  1753.         //----------------------------------------        
  1754.         CreateSyncItemCharacteristicsTD(main_line_element, SyncTreeArray[1].SyncItemCharacteristics);
  1755.         //----------------------------------------
  1756.         if(Menu_handlers_on == true)
  1757.             {
  1758.             var Gray0 = '';
  1759.             var Gray1 = '';
  1760.             if (SyncTreeArray[0].SyncItemCharacteristics.if_available == false) Gray0 = '_gray';    
  1761.             if (SyncTreeArray[1].SyncItemCharacteristics.if_available == false) Gray1 = '_gray';
  1762.             //----------------------------------------
  1763.             Left_radio_element.onmouseenter = ShowFM; 
  1764.             Left_radio_element.onmouseleave = HideFM; 
  1765.             Left_radio_element.onclick = OnPopupClick; 
  1766.             Left_radio_element.oncontextmenu = OnPopupContextMenu; 
  1767.             Left_radio_element.msg_id = MsgObj.objID;
  1768.             Left_radio_element.collection_id = CollectionID;                
  1769.             Left_radio_element.innerHTML = '<img src="Pics/Radio_left_'+SyncTreeArray[0].radio+Gray0+'.gif" class="Radio_control" '+SyncTreeArray[0].radio_handler+'>';            
  1770.             //----------------------------------------
  1771.             Left_arrow_element.onmouseenter = ShowFM; 
  1772.             Left_arrow_element.onmouseleave = HideFM; 
  1773.             Left_arrow_element.onclick = OnPopupClick; 
  1774.             Left_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1775.             Left_arrow_element.msg_id = MsgObj.objID;
  1776.             Left_arrow_element.collection_id = CollectionID;
  1777.             //----------------------------------------
  1778.             Mid_arrow_element.onmouseenter = ShowFM; 
  1779.             Mid_arrow_element.onmouseleave = HideFM; 
  1780.             Mid_arrow_element.onclick = OnPopupClick; 
  1781.             Mid_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1782.             Mid_arrow_element.msg_id = MsgObj.objID;
  1783.             Mid_arrow_element.collection_id = CollectionID;
  1784.             //----------------------------------------                
  1785.             Right_radio_element.onmouseenter = ShowFM; 
  1786.             Right_radio_element.onmouseleave = HideFM; 
  1787.             Right_radio_element.onclick = OnPopupClick; 
  1788.             Right_radio_element.oncontextmenu = OnPopupContextMenu; 
  1789.             Right_radio_element.msg_id = MsgObj.objID;
  1790.             Right_radio_element.collection_id = CollectionID;            
  1791.             Right_radio_element.innerHTML = '<img src="Pics/Radio_right_'+SyncTreeArray[1].radio+Gray1+'.gif" class="Radio_control" '+SyncTreeArray[1].radio_handler+'>';
  1792.             //----------------------------------------
  1793.             Right_arrow_element.onmouseenter = ShowFM; 
  1794.             Right_arrow_element.onmouseleave = HideFM; 
  1795.             Right_arrow_element.onclick = OnPopupClick; 
  1796.             Right_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1797.             Right_arrow_element.msg_id = MsgObj.objID;
  1798.             Right_arrow_element.collection_id = CollectionID;            
  1799.             }
  1800.         else
  1801.             {            
  1802.             Left_radio_element.innerHTML = '<div class="Without_radio"></div>';
  1803.             Right_radio_element.innerHTML = '<div class="Without_radio"></div>';
  1804.             }
  1805.         }
  1806.         
  1807.     if (SyncTreeList_length > 2)        
  1808.         {
  1809.         message_tbody_element.if_dont_sync = Radio_dont_sync;
  1810.         message_tbody_element.if_del_sync = Radio_del_sync;
  1811.         message_tbody_element.msg_type = "3";
  1812.         message_tbody_element.exist = "true";
  1813.         //First row
  1814.         var first_row_element = message_tbody_element.insertRow();
  1815.         first_row_element.className = 'First_row';
  1816.         CreateSyncItemCharacteristicsTD(first_row_element, SyncTreeArray[0].SyncItemCharacteristics);
  1817.         
  1818.         Left_radio_element = first_row_element.insertCell();
  1819.         Left_radio_element.className = "Left_cell";
  1820.         
  1821.         Left_arrow_element = first_row_element.insertCell();
  1822.         Left_arrow_element.height = "100%";
  1823.         Left_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_left_'+SyncTreeArray[0].arrow_direction+'"></div></div>';
  1824.                 
  1825.         Mid_arrow_element = first_row_element.insertCell();
  1826.         Mid_arrow_element.height = "100%";
  1827.         Mid_arrow_element.innerHTML = '<div id="Base_up_'+MsgObj.objID+'" class="Back_plate"><div class="Arrow_mid_top'+If_gray+'" ></div></div>';
  1828.                 
  1829.         Right_arrow_element = first_row_element.insertCell();
  1830.         Right_arrow_element.height = "100%";
  1831.         Right_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_right_'+SyncTreeArray[1].arrow_direction+'"></div></div>';
  1832.  
  1833.         Right_radio_element = first_row_element.insertCell();
  1834.         Right_radio_element.className = "Right_cell";
  1835.         
  1836.         if(Menu_handlers_on == true)
  1837.             {
  1838.             Left_radio_element.onmouseenter = ShowFM; 
  1839.             Left_radio_element.onmouseleave = HideFM; 
  1840.             Left_radio_element.onclick = OnPopupClick; 
  1841.             Left_radio_element.oncontextmenu = OnPopupContextMenu; 
  1842.             Left_radio_element.msg_id = MsgObj.objID;
  1843.             Left_radio_element.collection_id = CollectionID;
  1844.             var Gray = '';
  1845.             if (SyncTreeArray[0].SyncItemCharacteristics.if_available == false) Gray = '_gray';            
  1846.             Left_radio_element.innerHTML = '<img src="Pics/Radio_left_'+SyncTreeArray[0].radio+Gray+'.gif" class="Radio_control" '+SyncTreeArray[0].radio_handler+'>';            
  1847.             Left_arrow_element.onmouseenter = ShowFM; 
  1848.             Left_arrow_element.onmouseleave = HideFM; 
  1849.             Left_arrow_element.onclick = OnPopupClick; 
  1850.             Left_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1851.             Left_arrow_element.msg_id = MsgObj.objID;
  1852.             Left_arrow_element.collection_id = CollectionID;
  1853.             
  1854.             Mid_arrow_element.onmouseenter = ShowFM; 
  1855.             Mid_arrow_element.onmouseleave = HideFM; 
  1856.             Mid_arrow_element.onclick = OnPopupClick; 
  1857.             Mid_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1858.             Mid_arrow_element.msg_id = MsgObj.objID;
  1859.             Mid_arrow_element.collection_id = CollectionID;
  1860.                         
  1861.             Right_arrow_element.onmouseenter = ShowFM; 
  1862.             Right_arrow_element.onmouseleave = HideFM; 
  1863.             Right_arrow_element.onclick = OnPopupClick; 
  1864.             Right_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1865.             Right_arrow_element.msg_id = MsgObj.objID;
  1866.             Right_arrow_element.collection_id = CollectionID;
  1867.  
  1868.             Right_radio_element.onmouseenter = ShowFM; 
  1869.             Right_radio_element.onmouseleave = HideFM; 
  1870.             Right_radio_element.onclick = OnPopupClick; 
  1871.             Right_radio_element.oncontextmenu = OnPopupContextMenu; 
  1872.             Right_radio_element.msg_id = MsgObj.objID;
  1873.             Right_radio_element.collection_id = CollectionID;
  1874.             if (SyncTreeArray[1].SyncItemCharacteristics.if_available == false) Gray = '_gray';
  1875.             Right_radio_element.innerHTML = '<img src="Pics/Radio_right_'+SyncTreeArray[1].radio+Gray+'.gif" class="Radio_control" '+SyncTreeArray[1].radio_handler+'>';
  1876.             }
  1877.             else
  1878.             {            
  1879.             Left_radio_element.innerHTML = '<div class="Without_radio"></div>';
  1880.             Right_radio_element.innerHTML = '<div class="Without_radio"></div>';
  1881.             }
  1882.         
  1883.         CreateSyncItemCharacteristicsTD(first_row_element, SyncTreeArray[1].SyncItemCharacteristics);
  1884.  
  1885.         for(i=2; i<SyncTreeList_length-1; i++)    //Middle rows
  1886.             {
  1887.             var middle_row_element = message_tbody_element.insertRow();
  1888.             middle_row_element.className = 'Mid_row';
  1889.             CreateSyncItemCharacteristicsTD(middle_row_element, null);
  1890.             Left_radio_element = middle_row_element.insertCell();
  1891.             Left_radio_element.className = "Left_cell";
  1892.             Left_radio_element.innerHTML = '';
  1893.         
  1894.             Left_arrow_element = middle_row_element.insertCell();
  1895.             Left_arrow_element.height = "100%";
  1896.             Left_arrow_element.innerHTML = '<div class="Back_plate"></div>';
  1897.                 
  1898.             Mid_arrow_element = middle_row_element.insertCell();
  1899.             Mid_arrow_element.height = "100%";
  1900.             Mid_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_mid_mid'+If_gray+'" ></div>';
  1901.  
  1902.             Right_arrow_element = middle_row_element.insertCell();
  1903.             Right_arrow_element.height = "100%";
  1904.             Right_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_right_'+SyncTreeArray[i].arrow_direction+'"></div></div>';
  1905.  
  1906.             Right_radio_element = middle_row_element.insertCell();
  1907.             Right_radio_element.className = "Right_cell";
  1908.  
  1909.             if(Menu_handlers_on == true)
  1910.                 {
  1911.                 Left_radio_element.onmouseenter = ShowFM; 
  1912.                 Left_radio_element.onmouseleave = HideFM; 
  1913.                 Left_radio_element.onclick = OnPopupClick; 
  1914.                 Left_radio_element.oncontextmenu = OnPopupContextMenu; 
  1915.                 Left_radio_element.msg_id = MsgObj.objID;
  1916.                 Left_radio_element.collection_id = CollectionID;
  1917.  
  1918.                 Left_arrow_element.onmouseenter = ShowFM; 
  1919.                 Left_arrow_element.onmouseleave = HideFM; 
  1920.                 Left_arrow_element.onclick = OnPopupClick; 
  1921.                 Left_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1922.                 Left_arrow_element.msg_id = MsgObj.objID;
  1923.                 Left_arrow_element.collection_id = CollectionID;
  1924.             
  1925.                 Mid_arrow_element.onmouseenter = ShowFM; 
  1926.                 Mid_arrow_element.onmouseleave = HideFM; 
  1927.                 Mid_arrow_element.onclick = OnPopupClick; 
  1928.                 Mid_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1929.                 Mid_arrow_element.msg_id = MsgObj.objID;
  1930.                 Mid_arrow_element.collection_id = CollectionID;
  1931.             
  1932.                 Right_arrow_element.onmouseenter = ShowFM; 
  1933.                 Right_arrow_element.onmouseleave = HideFM; 
  1934.                 Right_arrow_element.onclick = OnPopupClick; 
  1935.                 Right_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1936.                 Right_arrow_element.msg_id = MsgObj.objID;
  1937.                 Right_arrow_element.collection_id = CollectionID;
  1938.             
  1939.                 Right_radio_element.onmouseenter = ShowFM; 
  1940.                 Right_radio_element.onmouseleave = HideFM; 
  1941.                 Right_radio_element.onclick = OnPopupClick; 
  1942.                 Right_radio_element.oncontextmenu = OnPopupContextMenu; 
  1943.                 Right_radio_element.msg_id = MsgObj.objID;
  1944.                 Right_radio_element.collection_id = CollectionID;
  1945.                 var Gray = '';
  1946.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false) Gray = '_gray';    
  1947.                 Right_radio_element.innerHTML = '<img src="Pics/Radio_right_'+SyncTreeArray[i].radio+Gray+'.gif" class="Radio_control" '+SyncTreeArray[i].radio_handler+'>';
  1948.                 }
  1949.                 else
  1950.                 {
  1951.                 Right_radio_element.innerHTML = '<div class="Without_radio"></div>';
  1952.                 }
  1953.             
  1954.             CreateSyncItemCharacteristicsTD(middle_row_element, SyncTreeArray[i].SyncItemCharacteristics);
  1955.             }
  1956.         //Last row
  1957.         var last_row_element = message_tbody_element.insertRow();
  1958.         last_row_element.className = 'Last_row';
  1959.         CreateSyncItemCharacteristicsTD(last_row_element, null);
  1960.         Left_radio_element = last_row_element.insertCell();
  1961.         Left_radio_element.className = "Left_cell";
  1962.         Left_radio_element.innerHTML = '';
  1963.     
  1964.         Left_arrow_element = last_row_element.insertCell();
  1965.         Left_arrow_element.height = "100%";
  1966.         Left_arrow_element.innerHTML = '<div class="Back_plate"></div>';
  1967.             
  1968.         Mid_arrow_element = last_row_element.insertCell();
  1969.         Mid_arrow_element.height = "100%";
  1970.         Mid_arrow_element.innerHTML = '<div id="Base_down_'+MsgObj.objID+'" class="Back_plate"><div class="Arrow_mid_bottom'+If_gray+'" ></div>';
  1971.  
  1972.         Right_arrow_element = last_row_element.insertCell();
  1973.         Right_arrow_element.height = "100%";
  1974.         Right_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_right_'+SyncTreeArray[SyncTreeList_length-1].arrow_direction+'"></div></div>';
  1975.       
  1976.         Right_radio_element = last_row_element.insertCell();
  1977.         Right_radio_element.className = "Right_cell";
  1978.  
  1979.         if(Menu_handlers_on == true)
  1980.             {
  1981.             Left_radio_element.onmouseenter = ShowFM; 
  1982.             Left_radio_element.onmouseleave = HideFM; 
  1983.             Left_radio_element.onclick = OnPopupClick; 
  1984.             Left_radio_element.oncontextmenu = OnPopupContextMenu; 
  1985.             Left_radio_element.msg_id = MsgObj.objID;
  1986.             Left_radio_element.collection_id = CollectionID;
  1987.  
  1988.             Left_arrow_element.onmouseenter = ShowFM; 
  1989.             Left_arrow_element.onmouseleave = HideFM; 
  1990.             Left_arrow_element.onclick = OnPopupClick;
  1991.             Left_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1992.             Left_arrow_element.msg_id = MsgObj.objID;
  1993.             Left_arrow_element.collection_id = CollectionID;
  1994.  
  1995.             Mid_arrow_element.onmouseenter = ShowFM; 
  1996.             Mid_arrow_element.onmouseleave = HideFM; 
  1997.             Mid_arrow_element.onclick = OnPopupClick; 
  1998.             Mid_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1999.             Mid_arrow_element.msg_id = MsgObj.objID;
  2000.             Mid_arrow_element.collection_id = CollectionID;
  2001.  
  2002.             Right_arrow_element.onmouseenter = ShowFM; 
  2003.             Right_arrow_element.onmouseleave = HideFM; 
  2004.             Right_arrow_element.onclick = OnPopupClick; 
  2005.             Right_arrow_element.oncontextmenu = OnPopupContextMenu; 
  2006.             Right_arrow_element.msg_id = MsgObj.objID;
  2007.             Right_arrow_element.collection_id = CollectionID;
  2008.  
  2009.             Right_radio_element.onmouseenter = ShowFM; 
  2010.             Right_radio_element.onmouseleave = HideFM; 
  2011.             Right_radio_element.onclick = OnPopupClick; 
  2012.             Right_radio_element.oncontextmenu = OnPopupContextMenu; 
  2013.             Right_radio_element.msg_id = MsgObj.objID;
  2014.             Right_radio_element.collection_id = CollectionID;
  2015.             var Gray = '';
  2016.             if (SyncTreeArray[SyncTreeList_length-1].SyncItemCharacteristics.if_available == false) Gray = '_gray';    
  2017.             Right_radio_element.innerHTML = '<img src="Pics/Radio_right_'+SyncTreeArray[SyncTreeList_length-1].radio+Gray+'.gif" class="Radio_control" '+SyncTreeArray[SyncTreeList_length-1].radio_handler+'>';
  2018.             }
  2019.             else
  2020.             {
  2021.             Right_radio_element.innerHTML = '<div class="Without_radio"></div>';
  2022.             }
  2023.  
  2024.         CreateSyncItemCharacteristicsTD(last_row_element, SyncTreeArray[SyncTreeList_length-1].SyncItemCharacteristics);            
  2025.         }        
  2026.         
  2027.     }
  2028. else    // Message is not sync item 
  2029.     {    
  2030.         var itemId_in_sync_item_collection = MsgObj.Method0('M_GetLinkID');        
  2031.         //var link_to_sync_item = '';
  2032.         if(CONST_CID != itemId_in_sync_item_collection)
  2033.             {                                
  2034.             var link_to_sync_item = '';
  2035.                                 //'<span style="cursor:hand; color:blue; margin-left:15px; text-decoration: underline;" '+
  2036.                                 //'onmouseover="OnMouseOverPath()" onmouseout="OnMouseOutPath()" '+
  2037.                                 //'onclick=LinkToCollectionMsg("All","'+itemId_in_sync_item_collection+'")>'+
  2038.                                 //external.LS('tooltip_goto_sync_item')+'</span>';                    
  2039.             }    
  2040.             else
  2041.             {
  2042.             var link_to_sync_item = '';
  2043.             }                
  2044.         
  2045.         message_tbody_element.exist = "true";
  2046.         message_tbody_element.oncontextmenu=OnMsgContextMenu;
  2047.         var single_row_element = message_tbody_element.insertRow();
  2048.         single_row_element.className = 'Single_row';
  2049.         mainline_cell_element = single_row_element.insertCell();
  2050.         mainline_cell_element.className="info_msg";
  2051.         mainline_cell_element.colSpan="11";
  2052.         mainline_cell_element.innerHTML = '<span id="Link'+CollectionID+MsgObj.objID+'"></span>'+
  2053.                                           MsgObj.ToString()+ 
  2054.                                           CreateMsgButtons(MsgObj)+
  2055.                                           link_to_sync_item;
  2056.         return;
  2057.     }        
  2058. }
  2059.  
  2060. //    --------------------------------------------------------------------------------
  2061. //    create HTML container for sync item according "SyncItemCharacteristics" variable
  2062. //    --------------------------------------------------------------------------------
  2063.  
  2064. function CreateSyncItemCharacteristicsHTML(SyncItemCharacteristics)
  2065.     {
  2066.     //
  2067.     var name         = '';
  2068.     var size         = '';
  2069.     var size_title    = '';
  2070.     var time         = '';
  2071.     var time_title    = '';
  2072.     var state        = '';    
  2073.     var state_style = '';
  2074.         
  2075.     if (SyncItemCharacteristics != null)
  2076.         {
  2077.         if(SyncItemCharacteristics.state == '')
  2078.             {
  2079.             name         = SyncItemCharacteristics.name;
  2080.             size         = SyncItemCharacteristics.size;
  2081.             size_title    = external.LS("tooltip_file_size");
  2082.             time         = SyncItemCharacteristics.time;
  2083.             time_title    = external.LS("tooltip_file_time");
  2084.             }
  2085.         if(SyncItemCharacteristics.state != '')
  2086.             {
  2087.             name         = SyncItemCharacteristics.name;
  2088.             state        = SyncItemCharacteristics.state;        
  2089.             if(SyncItemCharacteristics.if_missing == true)         state_style = 'style="color:red"';
  2090.             if(SyncItemCharacteristics.if_syncability == false) state_style = 'style="color:gray"';            
  2091.             if (SyncItemCharacteristics.if_available == false)  state_style = 'style="color:gray"';        
  2092.             }
  2093.         }    
  2094.     var name_html = '<td width="50%" class="SyncAttrName">' + name + '</td>';
  2095.     var size_html = '<td title="'+size_title+'" class="SyncAttrSize" ><span style="width:40px">' + size + '</span></td>';
  2096.     var time_html = '<td nowrap class="SyncAttribute" title="'+time_title+'" ><span style="width:90px">' + time + '</span></td>';
  2097.     var state_html= '<td class="SyncAttrState" colspan="2" valign="middle" align="center" nowrap '+ state_style +' >'+
  2098.                                                 '<span style="width:137px">'+ state + '</span></td>';                    
  2099.     if(state != '')     Item_html = name_html + state_html;
  2100.     else                Item_html = name_html + size_html + time_html;
  2101.         
  2102.     return     Item_html;
  2103.     }
  2104.     
  2105. function CreateSyncItemCharacteristicsTD(Row_element, SyncItemCharacteristics)
  2106.     {
  2107.     if(SyncItemCharacteristics == null)
  2108.         {
  2109.             name_element = Row_element.insertCell();
  2110.             name_element.width="50%";
  2111.             name_element.className="SyncAttrName";
  2112.             name_element.innerHTML = '';
  2113.             size_element = Row_element.insertCell();
  2114.             size_element.className="SyncAttrSize";
  2115.             size_element.innerHTML = '<span style="width:40px"></span>';
  2116.             time_element = Row_element.insertCell();
  2117.             time_element.className="SyncAttribute";
  2118.             time_element.noWrap = true;
  2119.             time_element.innerHTML = '<span style="width:90px"></span>';
  2120.             return;
  2121.         }
  2122.     if(SyncItemCharacteristics.state == '')
  2123.             {
  2124.             name_element = Row_element.insertCell();
  2125.             name_element.width="50%";
  2126.             name_element.className="SyncAttrName";
  2127.             name_element.innerHTML = SyncItemCharacteristics.name;
  2128.             size_element = Row_element.insertCell();
  2129.             size_element.className="SyncAttrSize";
  2130.             size_element.title = external.LS("tooltip_file_size");
  2131.             size_element.innerHTML = '<span style="width:40px">'+SyncItemCharacteristics.size+'</span>';
  2132.             time_element = Row_element.insertCell();
  2133.             time_element.className="SyncAttribute";
  2134.             time_element.noWrap = true;
  2135.             time_element.title = external.LS("tooltip_file_time");
  2136.             time_element.innerHTML = '<span style="width:90px">'+SyncItemCharacteristics.time+'</span>';
  2137.             }
  2138.             else
  2139.             {
  2140.             name_element = Row_element.insertCell();
  2141.             name_element.className="SyncAttrName";
  2142.             name_element.width="50%";
  2143.             name_element.innerHTML = SyncItemCharacteristics.name;
  2144.             state_element = Row_element.insertCell();
  2145.             state_element.className="SyncAttrState";
  2146.             state_element.colSpan="2";
  2147.             state_element.align="center";
  2148.             state_element.noWrap=true;
  2149.             if(SyncItemCharacteristics.if_missing == true) 
  2150.                 {
  2151.                 state_element.style.color="red";
  2152.                 if (SyncItemCharacteristics.if_syncability == false) state_element.style.color="gray";
  2153.                 }
  2154.             else if (SyncItemCharacteristics.if_available == false)
  2155.                 {
  2156.                 state_element.style.color="gray";
  2157.                 //if (SyncItemCharacteristics.if_syncability == true) state_element.style.color="red";
  2158.                 }    
  2159.             state_element.innerHTML = '<span style="width:137px">'+SyncItemCharacteristics.state+'</span>';
  2160.             }
  2161.     return;            
  2162.     }    
  2163.  
  2164. function ExtAddNewMsg(MsgCollectionObjID, MsgObjID, InsertPosition)
  2165.     {
  2166.     if (G_Collection_lock == true) return;
  2167.     
  2168.     var msg = external.ObjByID(MsgObjID);
  2169.     if(msg != null) 
  2170.         {        
  2171.         var Assoc    = msg.GetM('m_SlnDoAssocSyncWPtr');
  2172.         var AssocID = Assoc.objID;
  2173.         if(G_Assocs[AssocID].TreeView._collections[MsgCollectionObjID] != null)
  2174.            G_Assocs[AssocID].TreeView.add_message_node(MsgCollectionObjID, MsgObjID, InsertPosition);
  2175.         }        
  2176.     }
  2177.  
  2178.  
  2179. function ExtChangeMsg(MsgCollectionObjID, MsgObjID)
  2180.     {
  2181.     if (G_Collection_lock == true) return;
  2182.     
  2183.     if((G_Above_message.msg_id == MsgObjID) && (G_Above_message.collection_id == MsgCollectionObjID))    G_Above_message.mustshown = false;
  2184.         
  2185.     G_Shown_message.collection_id = null;
  2186.     G_Shown_message.msg_id = null;
  2187.     //------------------------------------
  2188.     var msg = external.ObjByID(MsgObjID);
  2189.     if(msg == null) return;
  2190.     //------------------------------------    
  2191.     var AssocID = msg.GetM('m_SlnDoAssocSyncWPtr').objID;
  2192.     if(G_Assocs[AssocID].TreeView._collections[MsgCollectionObjID] == null) return;
  2193.     //------------------------------------    
  2194.     var collection_container = document.getElementById('Assoc_'+AssocID).all[MsgCollectionObjID+'_container'];     
  2195.     //------------------------------------        
  2196.     var message_element = collection_container.children[MsgObjID]; 
  2197.     if(message_element == null)
  2198.         {
  2199.         return;
  2200.         }
  2201.     else if(message_element.exist == 'false')
  2202.         {
  2203.         return;
  2204.         }
  2205.     //------------------------------------        
  2206.     if(message_element.className.match(/Msg_Odd/))     MsgEvenness = 1;
  2207.     else                                            MsgEvenness = 0;            
  2208.     BuildMessageAsObject(message_element, MsgCollectionObjID, MsgObjID, MsgEvenness); 
  2209.     }
  2210.  
  2211. //--------------------------------------------------------------------------------------------------------------------------------
  2212. //
  2213. //-----------------------------------------------------------------------------------------------------------------
  2214.  
  2215. function OpenSyncRoot(SyncTreeID)
  2216.     {
  2217.     external.Method1ID('M_OpenButtonPressedForTree', SyncTreeID);
  2218.     }
  2219.  
  2220. //    ------------------------------------------------------------------------------------------------
  2221. //    create an object
  2222. //    ------------------------------------------------------------------------------------------------
  2223.  
  2224. function CreateSyncItemCharacteristics(solution, SuperTree_Obj, CollectionID)
  2225.     {    
  2226.     //    --------------------------------------------------------------------------------------------    
  2227.     //    picture for item (syncitem (by default), file, folder, link to important message)    
  2228.     this.picture =     '<img src="Pics/SyncItem.gif" style="margin-right:5px;">'; 
  2229.     this.name    = '';                //    path to Sync Item
  2230.     this.size    = '';                //    size of Sync Item (file)
  2231.     this.time    = '';                //    time of Sync Item (file)    
  2232.     this.state   = '';                //    AfterSyncState is one of three - created, deleted, modified
  2233.     this.if_missing = false;        //    if the file does not exist in     
  2234.     this.if_available = true;        //    if the file is available for processing     
  2235.     this.if_syncability = solution.Method0('M_GetAvailableItemForSynchronization'); // item will be synced or not    
  2236.     //    --------------------------------------------------------------------------------------------        
  2237.     var str_not_available = false;
  2238.     var file_SIC        = solution.Method1Own('M_GetSyncItemCharacteristicsBySuperTree', SuperTree_Obj); 
  2239.     var Tree_Is_Ready    = SuperTree_Obj.Method0('M_IsTreeReady');
  2240.     // -------------------------------------------------------------------------------------------------
  2241.     // if item is not available
  2242.     // -------------------------------------------------------------------------------------------------
  2243.     if (Tree_Is_Ready == false)    str_not_available = true;         
  2244.     if (file_SIC == null)        str_not_available = true;    
  2245.     if (str_not_available == true)
  2246.         {
  2247.         this.if_available = false;        
  2248.         this.state = external.LS("str_not_available");
  2249.         
  2250.         var is_dir1 = solution.Method0('M_IsCanHaveChildren');
  2251.         if(is_dir1)    this.picture =     '<img src="Pics/FolderGray.gif" style="margin-right:5px;">';
  2252.         else        this.picture =     '<img src="Pics/FileGray.gif" style="margin-right:5px;">';
  2253.         
  2254.         this.name = this.picture+'<div style="color:gray" >'+solution.Method1('M_CreateFullPathStrBySuperTree', SuperTree_Obj)+'</div>';
  2255.         this.name = this.name.replace(/\\/g,"\\<wbr>");
  2256.         return this;
  2257.         }    
  2258.     //---------------------------------------------------------------------------------------------------    
  2259.     var SyncTreeObject = SuperTree_Obj.GetFirst();
  2260.     var SyncRootPath = SyncTreeObject.Method0Own('M_ToFilename');     
  2261.     var levels_of_item_path_collection = solution.Method1Own('M_GetItemCollection', SuperTree_Obj);
  2262.     if(CONST_ShowFullFileName == false)  SyncRootPath = '';
  2263.     //---------------------------------------------------------------------------------------------------
  2264.     // Creating clickable parts of path
  2265.     // --------------------------------------------------------------------------------------------------        
  2266.     var path = '<span onclick="OpenSyncRoot(\''+SyncTreeObject.objID+
  2267.                '\')"  onmouseover="OnMouseOverPath()" onmouseout="OnMouseOutPath()" style="cursor:hand;" '+
  2268.                'title="'+external.LS("tooltip_open_the_rootfolder")+'">'+
  2269.                SyncRootPath+'</span>';        
  2270.     
  2271.     var level_of_item_path = levels_of_item_path_collection.GetFirst();    
  2272.     while(level_of_item_path != null)
  2273.         {
  2274.         var part_of_item_path = level_of_item_path.Method0('M_ToFilename');        
  2275.         if(level_of_item_path.Method1('M_GetItemExistenceBySuperTree', SuperTree_Obj) == false)
  2276.                 {                
  2277.                 path += '\\<wbr><span style="color:gray" >'+part_of_item_path+'</span>';
  2278.                 }
  2279.         else            
  2280.                 {                    
  2281.                 path += '\\<wbr><span onclick="ShowItem(\''+level_of_item_path.objID+'\', \''+SuperTree_Obj.objID+'\')" ';
  2282.                 path +=    'onmouseover="OnMouseOverPath()" onmouseout="OnMouseOutPath()" style="cursor:hand;" '+
  2283.                 'title="'+external.LS("tooltip_open_the_item")+'" >'+part_of_item_path+'</span>';
  2284.                 }                          
  2285.         level_of_item_path = levels_of_item_path_collection.GetNext(level_of_item_path);
  2286.         }        
  2287.     this.name = path;    
  2288.     //    --------------------------------------------------------------------------------------------------    
  2289.     // End of Creating clickable parts of path
  2290.     //    --------------------------------------------------------------------------------------------------    
  2291.     var is_not_exist = file_SIC.GetM('m_bMissing');
  2292.  
  2293.     var SolutionActionState = solution.Method0('M_GetActionState');//DU solution.GetM('MM_ActionState'); 
  2294.     if(SolutionActionState == CONST_ACTION_STATE_DONE) 
  2295.         {
  2296.         var AfterActionState = solution.Method1Own('M_GetActionDoneUserStrBySuperTree', SuperTree_Obj); 
  2297.         if(AfterActionState != null) this.state = AfterActionState;    
  2298.         }        
  2299.         //----------------------------------------------------
  2300.         var itemPicture = '';        
  2301.         var itemTooltip = '';         
  2302.         var is_dir = solution.Method0('M_IsCanHaveChildren');
  2303.         var itemId_in_important_collection = solution.Method0('M_GetLinkID');
  2304.         //----------------------------------------------------
  2305.         if (is_dir)            
  2306.             {
  2307.             this.size = external.LS('str_folder');
  2308.             itemTooltip = external.LS("tooltip_open_the_folder");
  2309.             if (is_not_exist)     itemPicture = "Pics/FolderGray.gif";
  2310.             else                 itemPicture = "Pics/Folder.gif";
  2311.             }
  2312.         else    // if item is file
  2313.             {
  2314.             var file_size = file_SIC.Method0('M_GetFileSizeStr');
  2315.             if(file_size != null)    this.size = file_size;
  2316.             itemTooltip = external.LS("tooltip_open_the_file");
  2317.             if (is_not_exist)     itemPicture = "Pics/FileGray.gif";
  2318.             else 
  2319.                 {                
  2320.                 // if the item has link to "important message"
  2321.                 if(CONST_CID != itemId_in_important_collection) 
  2322.                     {
  2323.                     itemPicture = "Pics/Warning_small.gif"; 
  2324.                     itemTooltip = external.LS("tooltip_goto_important_message");
  2325.                     }
  2326.                 else    itemPicture = "Pics/File.gif";
  2327.                 }            
  2328.             }
  2329.                     
  2330.         if (is_not_exist)
  2331.             {
  2332.             //alert(this.state + '-');
  2333.             if (this.state != external.LS("str_deleted")) // made by Core
  2334.                 this.state = external.LS("str_not_exist");
  2335.             this.if_missing = true;
  2336.             this.picture =     '<img src="'+itemPicture+'" style="margin-right:5px;">';
  2337.             this.name = this.picture + this.name;
  2338.             return this;
  2339.             }
  2340.         else
  2341.             {
  2342.             var file_time = file_SIC.Method0('M_GetFiletimeStr');
  2343.             if(file_time != null)    this.time = file_time;
  2344.             level_of_item_path = levels_of_item_path_collection.GetLast();
  2345.             // if the item has link to "important message"
  2346.             if(CONST_CID != itemId_in_important_collection)    
  2347.                 {
  2348.                 this.picture  = '<img src="'+itemPicture+'" '+
  2349.                                 'id="Link'+CollectionID+solution.ObjID+'"'+
  2350.                                 'title="'+itemTooltip+'" '+
  2351.                                 'style="cursor:hand; margin-right:5px;" '+
  2352.                                 'onclick=LinkToCollectionMsg("Important","'+itemId_in_important_collection+'")>';                
  2353.                 }
  2354.             else
  2355.                 {
  2356.                 this.picture =     '<img src="'+itemPicture+'" style="cursor:hand; margin-right:5px;"'+            
  2357.                                 'title="'+itemTooltip+'" '+
  2358.                                 'onclick="ShowItem(\''+level_of_item_path.objID+'\', \''+SuperTree_Obj.objID+'\')">';        
  2359.                 }                
  2360.             }                
  2361.         //-----------------------------------------------------        
  2362.         this.name = this.picture + this.name;
  2363.         return this;                    
  2364.     }
  2365.  
  2366. function ShowItem(SolutionID, SuperTreeID)
  2367.     {
  2368.     external.ShowItem(SuperTreeID, SolutionID);
  2369.     }
  2370.  
  2371. function CreateMsgButtons(MsgObj)
  2372.     {
  2373.     var msg_buttons = MsgObj.GetObjM('m_UserButtonsPtr');    
  2374.     buttons_html = "";
  2375.     if(msg_buttons != null) 
  2376.         {
  2377.         buttons_html += "<br/>";
  2378.         var button = msg_buttons.GetFirst();        
  2379.         //------------------------------------------------------------------------------------------
  2380.         var button_Type = button.Method0('M_GetType');        
  2381.         buttons_html += '<span style="white-space:nowrap; padding-left:20px;">';
  2382.         //------------------------------------------------------------------------------------------        
  2383.         while(button != null) 
  2384.             {
  2385.             if (button_Type == 0) // Button is button
  2386.                 {
  2387.                 buttons_html += '<BUTTON onclick=OnMsgButton("'+button.objID+'") class="msg_button">' +
  2388.                                     button.ToString() +
  2389.                                 '</BUTTON>';
  2390.                 }
  2391.             else if (button_Type == 1)    // button is text link                
  2392.                 {                
  2393.                 buttons_html += '<span '+
  2394.                                'onmouseover=OnMouseOverPath() onmouseout=OnMouseOutPath() '+
  2395.                                'onclick=OnMsgButton("'+button.objID+'") '+
  2396.                                'style="cursor:hand; color:blue; margin-left:15px; text-decoration: underline;">'+
  2397.                                ''+button.ToString()+''+'</span>';
  2398.                 }
  2399.             button = msg_buttons.GetNext(button);
  2400.             if (button != null) button_Type = button.Method0('M_GetType');
  2401.             }
  2402.         buttons_html += '</span>';
  2403.         }
  2404.     return buttons_html;
  2405.     }
  2406.  
  2407. function OnArrowClick(SolutionID, TreeID)
  2408.     {
  2409.     var solution = external.ObjByID(SolutionID); 
  2410.     solution.Method1ID('M_AlternativeSelected',TreeID);
  2411.     }
  2412.  
  2413. function OnMsgButton(button_objID) 
  2414.     {
  2415.     external.Method1('M_ButtonPressed', button_objID);
  2416.     }
  2417.  
  2418. function Ok_Activate(num)
  2419.     {
  2420.     Form_elem = document.getElementById('Assoc_'+G_ActiveAssocID).all["TreeForm"+num];
  2421.     SyncTreeID = Form_elem.parentElement.synctree_id;
  2422.     new_path = Form_elem.all[SyncTreeID+'_path'].value;
  2423.     if(Form_elem.is_empty == "false")
  2424.         {
  2425.         old_path = external.ObjByID(SyncTreeID).Method0Own('M_ToFilename'); 
  2426.         }
  2427.         else
  2428.         {
  2429.         old_path = "";
  2430.         }
  2431.     if(new_path != old_path)
  2432.         {
  2433.         Form_elem.all["TreeOk"+num].disabled = false;
  2434.         Form_elem.all["TreeCancel"+num].disabled = false;
  2435.         Form_elem.all["TreeOk"+num].style.backgroundImage = "url(Pics/Folder_button.gif)";
  2436.         Form_elem.all["TreeCancel"+num].style.backgroundImage = "url(Pics/Folder_button.gif)";    
  2437.         Form_elem.all["TreeOk"+num].style.cursor = "hand";
  2438.         Form_elem.all["TreeCancel"+num].style.cursor = "hand";
  2439.         Form_elem.is_changed = "true";
  2440.         }
  2441.         else
  2442.         {
  2443.         Form_elem.all["TreeOk"+num].disabled = true;
  2444.         Form_elem.all["TreeCancel"+num].disabled = true;
  2445.         Form_elem.all["TreeOk"+num].style.backgroundImage = "url(Pics/Folder_button_off.gif)";
  2446.         Form_elem.all["TreeCancel"+num].style.backgroundImage = "url(Pics/Folder_button_off.gif)";    
  2447.         Form_elem.all["TreeOk"+num].style.cursor = "none";
  2448.         Form_elem.all["TreeCancel"+num].style.cursor = "none";
  2449.         Form_elem.is_changed = "false";
  2450.         }
  2451.     }
  2452.  
  2453. //    ------------------------------------------------------------------------------
  2454. //    get SyncTree condition from profile
  2455. //    ------------------------------------------------------------------------------
  2456.  
  2457. function GetBackSyncBoard(num)
  2458.     {
  2459.     SyncTree_elem = document.getElementById('Assoc_'+G_ActiveAssocID).all["SyncTree"+num];
  2460.     SyncTreeID = SyncTree_elem.synctree_id;
  2461.     SyncTreeObj = external.ObjByID(SyncTreeID);
  2462.     if(SyncTreeObj.Method0('M_IsTreeReady') == 1)
  2463.         {
  2464.         SyncTree_path = SyncTreeObj.Method0Own('M_ToFilename'); 
  2465.         if_empty = "false";
  2466.         }
  2467.         else
  2468.         {
  2469.         SyncTree_path ="";
  2470.         if_empty = "true";
  2471.         }
  2472.     SyncTree_elem.all[SyncTreeID+"_path"].value = SyncTree_path;
  2473.     SyncTree_elem.all["TreeForm"+num].is_changed = "false";
  2474.     SyncTree_elem.all["TreeForm"+num].is_empty = if_empty;
  2475.     SyncTree_elem.all["TreeOk"+num].disabled = true; 
  2476.     SyncTree_elem.all["TreeCancel"+num].disabled = true;
  2477.     SyncTree_elem.all["TreeOk"+num].style.backgroundImage = "url(Pics/Folder_button_off.gif)";
  2478.     SyncTree_elem.all["TreeCancel"+num].style.backgroundImage = "url(Pics/Folder_button_off.gif)";    
  2479.     SyncTree_elem.all["TreeOk"+num].style.cursor = "none";
  2480.     SyncTree_elem.all["TreeCancel"+num].style.cursor = "none";
  2481.     }
  2482.  
  2483. //    ------------------------------------------------------------------------------
  2484. //    reload profile by core call
  2485. //    ------------------------------------------------------------------------------
  2486.  
  2487. function ExtOnProfileChanged()
  2488.     { 
  2489.     if(Flag_can_reload_profile == false)
  2490.         {
  2491.         return;
  2492.         }
  2493.     RemoveAllAssocsFromScreen();
  2494.     LoadProfile();
  2495.  
  2496.     ActivateAssoc(G_ActiveAssocID);    
  2497.     UpdateButtons(G_ActiveAssocID);
  2498.     ResizeWindow();
  2499.     }
  2500.  
  2501.  
  2502. //    -------------------------------------------------------------------------
  2503.  
  2504. function Activate_form(num)
  2505.     {
  2506.     SyncTree_obj = document.getElementById('Assoc_'+G_ActiveAssocID).all["SyncTree"+num];
  2507.         {    
  2508.         SyncTree_obj.className = "Active_panel";
  2509.         }
  2510.     }
  2511.     
  2512. //    -------------------------------------------------------------------------
  2513.  
  2514. function CancelSyncTree(num)    
  2515.     {
  2516.     var SyncTree_elem = document.getElementById('Assoc_'+G_ActiveAssocID).all["SyncTree"+num];
  2517.     SyncTree_elem.className = "Unactive_panel";
  2518.     GetBackSyncBoard(num);
  2519.     }
  2520.     
  2521. //    -------------------------------------------------------------------------
  2522.     
  2523. function BrowseSyncTree(num)
  2524.     {
  2525.     var SyncTree_elem = document.getElementById('Assoc_'+G_ActiveAssocID).all["SyncTree"+num];
  2526.     var SyncTreeID = SyncTree_elem.synctree_id;
  2527.     SyncTree_elem.className = "Unactive_panel";
  2528.     G_OnProfileChanged_called = false;
  2529.     external.Method1ID('M_BrowseButtonPressedForTree', SyncTreeID);
  2530.     if(G_OnProfileChanged_called == false)
  2531.             {
  2532.             GetBackSyncBoard(num);
  2533.             }
  2534.     }
  2535.  
  2536. //    -------------------------------------------------------------------------
  2537.  
  2538. function OpenSyncTree(num)
  2539.     {
  2540.     SyncTree_elem = document.getElementById('Assoc_'+G_ActiveAssocID).all["SyncTree"+num];
  2541.     SyncTreeID = SyncTree_elem.synctree_id;
  2542.     ChangeSyncTree(num);
  2543.     external.Method1ID('M_OpenButtonPressedForTree', SyncTreeID);
  2544.     }
  2545.     
  2546. function FolderButtonSelect(button)
  2547.     {
  2548.     button.style.backgroundImage="url(Pics/Folder_button_selected.gif)";
  2549.     }
  2550.  
  2551. function FolderButtonUnselect(button)
  2552.     {
  2553.     button.style.backgroundImage="url(Pics/Folder_button.gif)";
  2554.     }
  2555.  
  2556. function MainButtonSelect(button)
  2557.     {
  2558.     button.style.backgroundImage="url(Pics/Main_button_selected.gif)";
  2559.     }
  2560.  
  2561. function MainButtonUnselect(button)
  2562.     {
  2563.     button.style.backgroundImage="url(Pics/Main_button.gif)";
  2564.     }
  2565.  
  2566.  
  2567.  
  2568. //    -------------------------------------------------------------------------
  2569. //    called after changing one of rootfolder names 
  2570. //    -------------------------------------------------------------------------
  2571.  
  2572.  
  2573. function ChangeSyncTree(num) // spec.txt
  2574.     { 
  2575.     ExtCloseHint(G_ActiveAssocID, "Syncpath_hint_"+num);    
  2576.     AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);    
  2577.     SyncTree_elem = AssocElement.all["SyncTree"+num];    
  2578.     SyncTreeID = SyncTree_elem.synctree_id;    
  2579.     SyncTree_elem.className = "Unactive_panel";    
  2580.     Form_elem = AssocElement.all["TreeForm"+num];    
  2581.  
  2582.     //    if the path is changed
  2583.     if(Form_elem.is_changed == "true")
  2584.         {
  2585.         Form_elem.is_changed = "false";        
  2586.         new_path = AssocElement.all[SyncTreeID+'_path'].value;
  2587.  
  2588.         // if path is changed to empty, return to path
  2589.         if (new_path == "") {                
  2590.             SyncTreeObj = external.ObjByID(SyncTreeID);                    
  2591.             AssocElement.all[SyncTreeID+'_path'].value = SyncTreeObj.Method0Own('M_ToFilename');
  2592.             new_path = AssocElement.all[SyncTreeID+'_path'].value;            
  2593.             }
  2594.  
  2595.         G_Assocs[G_ActiveAssocID].OnAssocChangedCalled = false;
  2596.         var solution = external.method0Own('M_GetDoProfileSyncSolution');
  2597.         solution.SafeChangeTreePathAndUpdateProfile(SyncTreeID, new_path);
  2598.         
  2599.         // if there are not changes get condition of SyncTree from profile
  2600.         if(G_Assocs[G_ActiveAssocID].OnAssocChangedCalled == false)
  2601.             {
  2602.             GetBackSyncBoard(num);
  2603.             }
  2604.         }
  2605.     return false;
  2606.     }    
  2607.     
  2608. //    -------------------------------------------------------------------------
  2609.  
  2610.  
  2611. function Analyze_onclick() 
  2612. {      
  2613.       AnalyzeButtonElement = window.event.srcElement;
  2614.       //AnalyzeButtonElement.style.backgroungImage='url(Pics/Main_button.gif)';
  2615.       //AnalyzeButtonElement.style.backgroungImage='url(Pics/Main_button_off.gif)';
  2616.       AssocID = AnalyzeButtonElement.association_id;    
  2617.     ExtCloseHint(AssocID, 'Analyze_hint');    
  2618.     AssocObj = external.ObjByID(AssocID);
  2619.     AssocObj.CommandAnalyze();
  2620. }
  2621.  
  2622. function Synchronize_onclick() 
  2623. {
  2624.       SynchronizeButtonElement = window.event.srcElement;
  2625.       AssocID = SynchronizeButtonElement.association_id;
  2626.     ExtCloseHint(AssocID, 'Analyze_hint');    
  2627. //    ExtCloseHint(AssocID, 'Synchronize_hint');    
  2628.     AssocObj = external.ObjByID(AssocID);
  2629.       AssocObj.CommandSynchronize();
  2630. }
  2631.  
  2632. function Stop_onclick() 
  2633. {
  2634.     StopButtonElement = window.event.srcElement;
  2635.       AssocID = StopButtonElement.association_id;    
  2636.     AssocObj = external.ObjByID(AssocID);
  2637.     AssocObj.CommandStop();
  2638. }
  2639.  
  2640. function ExtBreakCollections(AssocID)
  2641.     {    
  2642.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Important']);
  2643.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Information']);    
  2644.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Questionable']);
  2645.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Deleted']);
  2646.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['New']);
  2647.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Changed']);    
  2648.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Unchanged']);
  2649.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['All']);
  2650.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Excluded']);
  2651.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['OverwriteByUser']);    
  2652.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['SyncFindItems']);    
  2653.     }
  2654.     
  2655. function ExtBreakCollection(AssocID, CollectionID)
  2656.     {
  2657.     CollectionObj = external.ObjByID(CollectionID);
  2658.     if((G_Assocs[AssocID].TreeView.root._children[CollectionID]._expanded == 1) && (CollectionObj.Method0('M_GetCount')>0))
  2659.         {        
  2660.         G_Assocs[AssocID].TreeView.click(CollectionID);
  2661.         }
  2662.     }
  2663.  
  2664. function CloseAnalyzeHint()
  2665.     {
  2666.     AnalyzeButtonElement = window.event.srcElement;
  2667.     ExtCloseHint(AnalyzeButtonElement.association_id, 'Analyze_hint');
  2668.     }
  2669.     
  2670. function UpdateButtons(AssocID) 
  2671.     {
  2672.     var AssocElement = document.getElementById('Assoc_'+AssocID);
  2673.     if(AssocElement == null) return;
  2674.     //----------------------------------------------------------------------------------
  2675.     var AssocObj = external.ObjByID(AssocID);
  2676.     AssocElement.all['B_ANALYZE'].disabled = !AssocObj.StatusAnalyze;
  2677.     if (AssocElement.all['B_ANALYZE'].disabled)
  2678.         {
  2679.         AssocElement.all['B_ANALYZE'].style.backgroundImage ='url(Pics/Main_button_off.gif)';
  2680.         AssocElement.all['B_ANALYZE'].style.cursor ='none';
  2681.         }
  2682.     else
  2683.         {
  2684.         AssocElement.all['B_ANALYZE'].style.backgroundImage ='url(Pics/Main_button.gif)';
  2685.         AssocElement.all['B_ANALYZE'].style.cursor ='hand';
  2686.         }    
  2687.     if(G_Assocs[AssocID].Folders_is_ready == true)
  2688.         {
  2689.         var FolderArray_length = G_Assocs[AssocID].Folder_is_ready_array.length;
  2690.         for(var i=0; i<FolderArray_length; i++)
  2691.             {
  2692.             DisableFSP(AssocID, i, !AssocObj.StatusAnalyze, true);
  2693.             }
  2694.         }
  2695.         else
  2696.         {
  2697.         var FolderArray_length = G_Assocs[AssocID].Folder_is_ready_array.length;
  2698.         for(var i=0; i<FolderArray_length; i++)
  2699.             {
  2700.             DisableFSP(AssocID, i, false, G_Assocs[AssocID].Folder_is_ready_array[i]);
  2701.             }
  2702.         }
  2703.       //------------------------------------------------------------------------------------
  2704.       AssocElement.all['B_SYNC'].disabled = !AssocObj.StatusSynchronize;
  2705.     if (AssocElement.all['B_SYNC'].disabled)
  2706.         {
  2707.         AssocElement.all['B_SYNC'].style.backgroundImage ='url(Pics/Main_button_off.gif)';
  2708.         AssocElement.all['B_SYNC'].style.cursor ='none';
  2709.         }
  2710.     else
  2711.         {
  2712.         AssocElement.all['B_SYNC'].style.backgroundImage ='url(Pics/Main_button.gif)';
  2713.         AssocElement.all['B_SYNC'].style.cursor ='hand';
  2714.         }    
  2715.       //------------------------------------------------------------------------------------
  2716.       AssocElement.all['B_STOP'].disabled = !AssocObj.StatusStop;
  2717.     if (AssocElement.all['B_STOP'].disabled)
  2718.         {
  2719.         AssocElement.all['B_STOP'].style.backgroundImage ='url(Pics/Main_button_off.gif)';
  2720.         AssocElement.all['B_STOP'].style.cursor ='none';
  2721.         }
  2722.     else
  2723.         {
  2724.         AssocElement.all['B_STOP'].style.backgroundImage ='url(Pics/Main_button.gif)';
  2725.         AssocElement.all['B_STOP'].style.cursor ='hand';
  2726.         }    
  2727.       //------------------------------------------------------------------------------------
  2728.     }
  2729.     
  2730. function UpdateButtonsTitle(AssocID, Status)
  2731.     {
  2732.     var AssocElement = document.getElementById('Assoc_'+AssocID);
  2733.     if    (Status == STATUS_ATTRIBUTE_ANALYZING || 
  2734.          Status == STATUS_ATTRIBUTE_SYNCHRONIZING)    AssocElement.all['B_STOP'].innerText = external.LS("button_stop");
  2735.     else                                            AssocElement.all['B_STOP'].innerText = external.LS("button_clear");        
  2736.     }
  2737.     
  2738. function UpdateAssocStatus(AssocID, status)
  2739.     {
  2740.     //---------------------------------------------------------------------------------------------------------
  2741.     var AssocElement = document.getElementById('Assoc_'+AssocID);
  2742.     if(!AssocElement)    return;
  2743.     //---------------------------------------------------------------------------------------------------------
  2744.     var LabelCell = TabsLabels.cells['Label_'+AssocID]; 
  2745.     if(!LabelCell) return;//DU: the association tab has not been added yet
  2746.     //---------------------------------------------------------------------------------------------------------    
  2747.     var SyncBoardsTable_element = AssocElement.all['SyncBoardsTable'];
  2748.     if         (status == STATUS_ATTRIBUTE_ANALYZING)         SyncBoardsTable_element.className = 'Analyze_State';
  2749.     else if (status == STATUS_ATTRIBUTE_SYNCHRONIZING)     SyncBoardsTable_element.className = 'Sync_State';
  2750.     else                                                 SyncBoardsTable_element.className = 'Normal_State';
  2751.     //---------------------------------------------------------------------------------------------------------
  2752.     var LabelImg = LabelCell.all['Status_img'];
  2753.     if        (status == 0)                                        LabelImg.src = 'Pics/Status_normal.gif';
  2754.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC)                LabelImg.src = 'Pics/Status_schedule.gif';
  2755.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC_INTERNAL)     LabelImg.src = 'Pics/Status_schedule.gif';
  2756.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC_DISABLED)        LabelImg.src = 'Pics/Status_manual.gif';
  2757.     else if    (status == STATUS_ATTRIBUTE_ANALYZING)                LabelImg.src = 'Pics/Status_analyze.gif';
  2758.     else if    (status == STATUS_ATTRIBUTE_SYNCHRONIZING)            LabelImg.src = 'Pics/Status_synchronize.gif';
  2759.     else if    (status == STATUS_ATTRIBUTE_INFORMATION_MESSAGE)    LabelImg.src = 'Pics/Status_information.gif';
  2760.     else if    (status == STATUS_ATTRIBUTE_IMPORTANT_MESSAGE)        LabelImg.src = 'Pics/Status_important.gif';
  2761.     else if    (status == STATUS_ATTRIBUTE_INCOMPLETE)                LabelImg.src = 'Pics/Status_incomplete.gif';
  2762.     //---------------------------------------------------------------------------------------------------------    
  2763.     UpdateButtonsTitle(AssocID, status);
  2764.     //---------------------------------------------------------------------------------------------------------
  2765.     }    
  2766.  
  2767. function ExtOnStatusAttributeChanged(AssocID, StatusAttribute) //aaaa
  2768.     {     
  2769.     var AssocObj = external.ObjByID(AssocID);
  2770.     var Status = AssocObj.Method0('M_GetAggregatedGeneralStatus');
  2771.          
  2772.     if( StatusAttribute == STATUS_ATTRIBUTE_ANALYZE_ENABLED ||
  2773.         StatusAttribute == STATUS_ATTRIBUTE_SYNCHRONIZE_ENABLED ||    
  2774.         StatusAttribute == STATUS_ATTRIBUTE_STOP_ENABLED)            UpdateButtons(AssocID);
  2775.     else                                                            UpdateAssocStatus(AssocID, Status);    
  2776.     if (AssocID == G_ActiveAssocID)
  2777.         ExtUpdateProgressBar(AssocID, external.Method0('M_GetProgressState'), external.Method0('M_GetProgressPercent')); // New !!                
  2778.     }
  2779.  
  2780. function DisableFSP(AssocID, FSPnum, if_disabled, Open_is_enabled)
  2781.     {
  2782.     var AssocElement2 = document.getElementById('Assoc_'+AssocID);
  2783.     var SyncTree_element = AssocElement2.all["SyncTree"+FSPnum];
  2784.     SyncTree_element.all["TreePath"+FSPnum].disabled = if_disabled;
  2785.     SyncTree_element.all["TreeSubmitButtons"+FSPnum].disabled = if_disabled;
  2786.     SyncTree_element.all["TreeBrowse"+FSPnum].disabled = if_disabled;
  2787.     SyncTree_element.all["TreeOpen"+FSPnum].disabled = !Open_is_enabled; 
  2788.     //-----------------------------------------------------------------------------------------
  2789.     if (SyncTree_element.all["TreeOk"+FSPnum].disabled)
  2790.         {        
  2791.         SyncTree_element.all["TreeOk"+FSPnum].style.backgroundImage = "url(Pics/Folder_button_off.gif)";
  2792.         SyncTree_element.all["TreeOk"+FSPnum].style.cursor="none";
  2793.         }
  2794.     else
  2795.         {
  2796.         SyncTree_element.all["TreeOk"+FSPnum].style.backgroundImage = "url(Pics/Folder_button.gif)";
  2797.         SyncTree_element.all["TreeOk"+FSPnum].style.cursor="hand";
  2798.         }    
  2799.     //-----------------------------------------------------------------------------------------
  2800.     if (SyncTree_element.all["TreeCancel"+FSPnum].disabled)
  2801.         {
  2802.         SyncTree_element.all["TreeCancel"+FSPnum].style.backgroundImage = "url(Pics/Folder_button_off.gif)";
  2803.         SyncTree_element.all["TreeCancel"+FSPnum].style.cursor="none";
  2804.         }
  2805.     else
  2806.         {
  2807.         SyncTree_element.all["TreeCancel"+FSPnum].style.backgroundImage = "url(Pics/Folder_button.gif)";
  2808.         SyncTree_element.all["TreeCancel"+FSPnum].style.cursor="hand";
  2809.         }    
  2810.     //-----------------------------------------------------------------------------------------
  2811.     if (SyncTree_element.all["TreeOpen"+FSPnum].disabled)
  2812.         {
  2813.         SyncTree_element.all["TreeOpen"+FSPnum].style.backgroundImage = "url(Pics/Folder_button_off.gif)";
  2814.         SyncTree_element.all["TreeOpen"+FSPnum].style.cursor="none";        
  2815.         }
  2816.     else
  2817.         {
  2818.         SyncTree_element.all["TreeOpen"+FSPnum].style.backgroundImage = "url(Pics/Folder_button.gif)";
  2819.         SyncTree_element.all["TreeOpen"+FSPnum].style.cursor="hand";        
  2820.         }
  2821.     //-----------------------------------------------------------------------------------------
  2822.     if (SyncTree_element.all["TreeBrowse"+FSPnum].disabled)
  2823.         {
  2824.         SyncTree_element.all["TreeBrowse"+FSPnum].style.backgroundImage = "url(Pics/Folder_button_off.gif)";
  2825.         SyncTree_element.all["TreeBrowse"+FSPnum].style.cursor="none";        
  2826.         }
  2827.     else
  2828.         {
  2829.         SyncTree_element.all["TreeBrowse"+FSPnum].style.backgroundImage = "url(Pics/Folder_button.gif)";
  2830.         SyncTree_element.all["TreeBrowse"+FSPnum].style.cursor="hand";        
  2831.         }    
  2832.     //-----------------------------------------------------------------------------------------
  2833.     return;
  2834.     }    
  2835.  
  2836. function PlaceHintWindow(element, num)
  2837.     {
  2838.     if(element == null)
  2839.         {
  2840.         return;
  2841.         }
  2842.     var _left=-250;
  2843.     var _top=25;
  2844.     while(element.tagName!= 'BODY')
  2845.         {
  2846.         _left += element.offsetLeft;
  2847.         _top += element.offsetTop;
  2848.         element = element.offsetParent;
  2849.         }
  2850.     Hint_window.hint_number = num;
  2851.     Hint_window.style.left = _left;
  2852.     Hint_window.style.top = _top;
  2853.     }
  2854.     
  2855. function ExtGiveHint(AssocID, Hint_element_id)
  2856.     {
  2857.     if(AssocID != G_ActiveAssocID)
  2858.         {
  2859.         return;
  2860.         }
  2861.     hint_element = document.getElementById('Assoc_'+AssocID).all[Hint_element_id];
  2862.     
  2863.     if(Hint_element_id == "Syncpath_hint_0")
  2864.         {
  2865.         hint_width = hint_element.offsetWidth-17;
  2866.         close_left = hint_element.offsetWidth-15;
  2867.         hint_element.innerHTML = '<div style="position:absolute; top:0; left:0; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow1.png\'); z-index:10"></div>'+
  2868.                 '<div style="position:absolute; top:18; left:17; width:'+hint_width+'; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2869.                     external.LS("hint_syncpath_left")+'</div>'+
  2870.                     '<img src="Pics/closehint.gif" onclick="ExtCloseHint(\''+AssocID+'\', \''+Hint_element_id+'\')" style="position:absolute; left:'+close_left+'px; top:18px;">';
  2871.         hint_element.style.visibility = "inherit";
  2872.         }
  2873.     else if(Hint_element_id == "Syncpath_hint_1")
  2874.         {
  2875.         hint_width = Hint_window.offsetWidth-17;
  2876.         arrow_left = Hint_window.offsetWidth-26;
  2877.         Hint_window.innerHTML = '<div style="position:absolute; top:0; left:'+arrow_left+'; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow2.png\'); z-index:10"></div>'+
  2878.                 '<div style="position:absolute; top:18; left:0; width:'+hint_width+'; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2879.                     external.LS("hint_syncpath_right")+'</div>'+
  2880.                     '<img src="Pics/closehint.gif" onclick="ExtCloseHint(\''+AssocID+'\', \''+Hint_element_id+'\')" style="position:absolute; left:0px; top:18px;">';
  2881.         Hint_window.style.visibility = "visible";
  2882.         }
  2883.     else if(Hint_element_id == "Analyze_hint")
  2884.         {
  2885.         close_left = hint_element.offsetWidth+2;
  2886.         hint_element.innerHTML = '<div style="position:relative; top:0; left:17; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2887.                         external.LS("hint_analyze")+'</div>'+
  2888.                         '<img src="Pics/closehint.gif" onclick="ExtCloseHint(\''+AssocID+'\', \''+Hint_element_id+'\')" style="position:absolute; left:'+close_left+'px; top:0px;">'+
  2889.                             '<div style="position:relative; left:0; right:0; width:250px; height:18px;">'+
  2890.                     '<div style="position:absolute; top:-8; left:0; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow3.png\'); z-index:10"></div></div>'
  2891.         hint_height = hint_element.offsetHeight;
  2892.         hint_element.style.top = -5-hint_height;
  2893.         hint_element.style.visibility = "inherit";
  2894.                 
  2895.         }
  2896.     else if(Hint_element_id == "Synchronize_hint")
  2897.         {
  2898.         hint_element.innerHTML = '<div style="position:relative; top:0; left:17; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2899.                         external.LS("hint_synchronize")+'</div>'+
  2900.                             '<div style="position:relative; left:0; right:0; width:250px; height:18px;">'+
  2901.                     '<img src="Pics/Hint_arrow3.gif" style="position:absolute; top:-8; left:0; z-index:10"></div>'
  2902.         hint_height = hint_element.offsetHeight;
  2903.         hint_element.style.top = -5-hint_height;
  2904.         hint_element.style.visibility = "inherit";
  2905.         }
  2906.     else
  2907.         {
  2908.         hint_width = Hint_window.offsetWidth-17;
  2909.         arrow_left = Hint_window.offsetWidth-26;
  2910.         Hint_window.innerHTML = '<div style="position:absolute; top:0; left:'+arrow_left+'; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow2.png\'); z-index:10"></div>'+
  2911.                 '<div style="position:absolute; top:18; left:0; width:'+hint_width+'; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2912.                     external.LS("hint_syncpath_right")+'</div>'+
  2913.                     '<img src="Pics/closehint.gif" style="position:absolute; left:0px; top:18px;">';
  2914.         Hint_window.style.visibility = "visible";
  2915.         }
  2916.     }
  2917.     
  2918. function ExtCloseHint(AssocID, Hint_element_id)
  2919.     {
  2920.     Hint_window.style.visibility = "hidden";
  2921.     Hint_window.hint_number = '';
  2922.     hint_element = document.getElementById('Assoc_'+AssocID).all[Hint_element_id];
  2923.     if(hint_element != null)
  2924.         {
  2925.         hint_element.innerHTML = "";
  2926.         hint_element.style.visibility = "hidden";
  2927.         }
  2928.     }
  2929.     
  2930. function ScrollToImportant()
  2931.     {
  2932.     AssocID = G_ActiveAssocID;
  2933.     ImportantID = G_Assocs[AssocID].TreeView._collectionIdByName['Important'];
  2934.     if(G_Assocs[AssocID].TreeView.root._children[ImportantID]._expanded == 0)
  2935.         {
  2936.         OnCollectionExpandIconClick(AssocID, ImportantID);
  2937.         }
  2938.     ImportantCollectionElement = document.getElementById('Assoc_'+AssocID).all[ImportantID];
  2939.     ImportantCollectionElement.scrollIntoView(); 
  2940.     }
  2941.     
  2942. function ExtShowCollection(CollectionID)    
  2943.     {
  2944.     var AssocID = G_ActiveAssocID;
  2945.     if(G_Assocs[AssocID].TreeView.root._children[CollectionID]._expanded == 0)
  2946.         {
  2947.         OnCollectionExpandIconClick(AssocID, CollectionID);
  2948.         }
  2949.     var CollectionElement = document.getElementById('Assoc_'+AssocID).all[CollectionID];
  2950.     CollectionElement.scrollIntoView();
  2951.     }
  2952.     
  2953. function TabsCaptionResized()
  2954.     {
  2955.     if(TabsCaption.scrollLeft>0)
  2956.         {
  2957.         LeftTabScroller.src = "Pics/TabCaptionScroller1.gif";
  2958.         LeftTabScroller.onmousedown = LeftTabScrollerDown;
  2959.         LeftTabScroller.onmouseup = TabScrollerReleased;
  2960.         LeftTabScroller.onmouseleave = TabScrollerReleased;
  2961.         }
  2962.         else
  2963.         {
  2964.         LeftTabScroller.src = "Pics/TabCaptionScroller0.gif";
  2965.         LeftTabScroller.onmousedown = '';
  2966.         }
  2967.     if(TabsCaption.scrollWidth-TabsCaption.clientWidth-TabsCaption.scrollLeft >0)
  2968.         {
  2969.         RightTabScroller.src = "Pics/TabCaptionScroller2.gif";
  2970.         RightTabScroller.onmousedown = RightTabScrollerDown;
  2971.         RightTabScroller.onmouseup = TabScrollerReleased;
  2972.         RightTabScroller.onmouseleave = TabScrollerReleased;
  2973.         }
  2974.         else
  2975.         {
  2976.         RightTabScroller.src = "Pics/TabCaptionScroller0.gif";
  2977.         RightTabScroller.onmousedown = '';
  2978.         }
  2979.     }
  2980.  
  2981. function TabLabelOnClick1(AssocID)
  2982.     {
  2983.     external.Method1('M_SelectAssoc', external.ObjByID(AssocID));
  2984.     }
  2985.  
  2986. function TabLabelContextMenu(AssocID)
  2987.     {
  2988.     window.event.cancelBubble = true;
  2989.     var AssocObj = external.ObjByID(AssocID);
  2990.     external.ShowContextMenu(AssocObj, CONST_CID);
  2991.     }
  2992.  
  2993. //---------------------------------------------------------------------------------------
  2994.  
  2995. function ScrollTabLabelIntoView(AssocID)
  2996.     {
  2997.     LabelCell = TabsLabels.cells['Label_'+AssocID];
  2998.     LeftLabelOut = TabsCaption.scrollLeft - LabelCell.offsetLeft+15;
  2999.     RightLabelOut = (LabelCell.offsetLeft+LabelCell.offsetWidth+16) - (TabsCaption.scrollLeft+TabsCaption.clientWidth);
  3000.     //----------------------------------------------------------------------------------------
  3001.     if       ((LeftLabelOut<0)&&(RightLabelOut<0))return;        
  3002.     else if (LeftLabelOut<0)                    ScrollTabToPixels('Right', RightLabelOut);        
  3003.     else if (RightLabelOut<0)                    ScrollTabToPixels('Left', LeftLabelOut);        
  3004.     else if((LeftLabelOut>0)&&(RightLabelOut>0))
  3005.              if(LeftLabelOut > RightLabelOut)    ScrollTabToPixels('Right', RightLabelOut);            
  3006.             else                                ScrollTabToPixels('Left', LeftLabelOut);            
  3007.     }
  3008.  
  3009. //---------------------------------------------------------------------------------------
  3010.  
  3011. function LeftTabScrollerDown()
  3012.     {
  3013.     G_TabScrollingProcessNum++;
  3014.     RightTabScroller.src = "Pics/TabCaptionScroller2.gif";
  3015.     RightTabScroller.onmousedown = RightTabScrollerDown;
  3016.     RightTabScroller.onmouseup = TabScrollerReleased;
  3017.     RightTabScroller.onmouseleave = TabScrollerReleased;
  3018.     ScrollTabTo('Left', G_TabScrollingProcessNum);
  3019.     }
  3020.             
  3021. function RightTabScrollerDown()
  3022.     {
  3023.     G_TabScrollingProcessNum++;
  3024.     LeftTabScroller.src = "Pics/TabCaptionScroller1.gif";
  3025.     LeftTabScroller.onmousedown = LeftTabScrollerDown;
  3026.     LeftTabScroller.onmouseup = TabScrollerReleased;
  3027.     LeftTabScroller.onmouseleave = TabScrollerReleased;
  3028.     ScrollTabTo('Right', G_TabScrollingProcessNum);
  3029.     }
  3030.  
  3031. function TabScrollerReleased()
  3032.     {
  3033.     G_TabScrollingProcessNum++;
  3034.     }
  3035.  
  3036. //----------------------------------------------------------------------------------------
  3037.  
  3038. function ScrollTabTo(Direction, ProcessNum)
  3039.     {
  3040.     if(ProcessNum == G_TabScrollingProcessNum)
  3041.         {
  3042.         if(Direction == 'Left')
  3043.         if(TabsCaption.scrollLeft >5)
  3044.             {
  3045.             TabsCaption.scrollLeft -= 5;
  3046.             window.setTimeout("ScrollTabTo('Left',"+ProcessNum+")", 5);
  3047.             }
  3048.             else
  3049.             {
  3050.             TabsCaption.scrollLeft = 0;
  3051.             LeftTabScroller.src = "Pics/TabCaptionScroller0.gif";
  3052.             LeftTabScroller.onmousedown = '';
  3053.             }
  3054.         if(Direction == 'Right')
  3055.         if(TabsCaption.scrollWidth-TabsCaption.clientWidth-TabsCaption.scrollLeft >5)
  3056.             {
  3057.             TabsCaption.scrollLeft += 5;
  3058.             window.setTimeout("ScrollTabTo('Right',"+ProcessNum+")", 5);
  3059.             }
  3060.             else
  3061.             {    
  3062.             TabsCaption.scrollLeft = TabsCaption.scrollWidth-TabsCaption.clientWidth;
  3063.             RightTabScroller.src = "Pics/TabCaptionScroller0.gif";
  3064.             RightTabScroller.onmousedown = '';
  3065.             }
  3066.         }        
  3067.     }
  3068. //---------------------------------------------------------------------------------------
  3069.  
  3070. function ScrollTabToPixels(Direction, PixelNumber)
  3071.     {
  3072.     if (Direction == 'Left')
  3073.         {
  3074.         if(PixelNumber > TabsCaption.scrollLeft)    PixelNumber = TabsCaption.scrollLeft;                 
  3075.         TabsCaption.scrollLeft = TabsCaption.scrollLeft-PixelNumber;
  3076.         }        
  3077.     if (Direction == 'Right')
  3078.         {
  3079.         var temp = TabsCaption.scrollWidth - TabsCaption.clientWidth - TabsCaption.scrollLeft;
  3080.         if(PixelNumber > temp)    PixelNumber = temp;    
  3081.         TabsCaption.scrollLeft = TabsCaption.scrollLeft+PixelNumber;                
  3082.         }        
  3083.     TabsCaptionResized();
  3084.     }
  3085.  
  3086. //---------------------------------------------------------------------------------------
  3087.  
  3088. function CloseAnalizeHint() 
  3089.     {
  3090.     AnalyzeButtonElement = window.event.srcElement;
  3091.       AssocID = AnalyzeButtonElement.association_id;    
  3092.     ExtCloseHint(AssocID, 'Analyze_hint');    
  3093.     }
  3094.  
  3095. function ExtAddNewAssoc()
  3096.     {
  3097.     NewAssoc();
  3098.     }
  3099.  
  3100.  
  3101. //    -------------------------------------------------------------------
  3102. //    change active association for core
  3103. //    -------------------------------------------------------------------
  3104.     
  3105. function ExtSelectAssoc(AssocID) 
  3106.     {
  3107.     DeactivateAssoc(G_ActiveAssocID);
  3108.     ActivateAssoc(AssocID);
  3109.     }
  3110.     
  3111. //    -------------------------------------------------------------------
  3112. //    change name of active association for core
  3113. //    -------------------------------------------------------------------
  3114.     
  3115. function RenameAssoc()
  3116.     {
  3117.     ExtAskNewAssocName(G_ActiveAssocID);
  3118.     }
  3119.  
  3120. function ExtAskNewAssocName(AssocID) 
  3121.     {
  3122.     var AssocObj = external.ObjByID(AssocID);
  3123.     var OldName = AssocObj.Method0('M_GetAssocName');
  3124.     var NewAssocName = prompt(external.LS("rename_association_prompt"), OldName);
  3125.     TabsLabels.cells['Label_'+AssocID].all['TabCaptionText'].innerText = AssocObj.Method1('M_SetAssocName', NewAssocName);
  3126.     } 
  3127.  
  3128. //    -------------------------------------------------------
  3129. //  alert ("Show middle menu for each item of each collections");
  3130. //    -------------------------------------------------------
  3131. function ShowFM()
  3132.     {
  3133.     var Src_cell = window.event.srcElement;    
  3134.     G_Above_message.msg_id = Src_cell.msg_id;        
  3135.     G_Above_message.collection_id = Src_cell.collection_id;            
  3136.     window.setTimeout("OpenMenu(\'"+Src_cell.msg_id+"\', \'"+Src_cell.collection_id+"\')", 250);
  3137.     }
  3138.  
  3139. function HideFM()
  3140.     {
  3141.     if(G_Above_message.latch == false)
  3142.         {
  3143.         var Src_cell = window.event.srcElement;
  3144.         G_Above_message.msg_id = null;
  3145.  
  3146.         G_Above_message.collection_id = null;
  3147.  
  3148.         if(G_Above_message.mustshown == false)
  3149.             {
  3150.             window.setTimeout("LeadUp(\'"+Src_cell.msg_id+"\', \'"+Src_cell.collection_id+"\')", 10);
  3151.             }
  3152. //        Debug_window.innerHTML += (G_debug_line_number++)+' HideFM: Shown = '+G_Shown_message.msg_id+' Above = '+G_Above_message.msg_id+' : '+G_Above_message.mustshown+'<br>';
  3153.         window.setTimeout("CloseMenu(\'"+Src_cell.msg_id+"\', \'"+Src_cell.collection_id+"\')", 500);
  3154.         }
  3155.     }
  3156. //    -------------------------------------------------------------------------------------------------
  3157. //    Function for requesting of Vova's context menu
  3158. //    -------------------------------------------------------------------------------------------------
  3159. function OnMsgContextMenu()
  3160.     {
  3161.     window.event.cancelBubble = true;
  3162.     element = window.event.srcElement;
  3163.     while(element.tagName != 'TBODY')
  3164.         {
  3165.         element = element.parentElement;
  3166.         }
  3167.     // show context menu if object exist
  3168.     if (element.id)
  3169.         {               
  3170.            var MessageObj = external.ObjByID(element.id);
  3171.         if (MessageObj != null) 
  3172.             {                 
  3173.             if (MessageObj.IsSyncItemMsg())
  3174.                 {
  3175.                 var Solution = MessageObj.GetM('m_SolutionWPtr');                                            
  3176.                 if (Solution != null) 
  3177.                     {
  3178.                     while (!element.sub_id)    
  3179.                           {
  3180.                           element = element.parentElement;                          
  3181.                           }
  3182.                         external.ShowContextMenu(Solution, element.sub_id);
  3183.                     }
  3184.                 }
  3185.             else {                      
  3186.                   external.ShowContextMenu(MessageObj, CONST_CID);                  
  3187.                  }
  3188.             }
  3189.         }        
  3190.     }
  3191. //    -------------------------------------------------------------------------------------------------
  3192. //    alert('Cover/Show millde item for accosiation' );
  3193. //    -------------------------------------------------------------------------------------------------
  3194. function OnPopupClick()
  3195.     {    
  3196.     if(G_Above_message.mustshown == true)
  3197.         {
  3198.         G_Above_message.mustshown = false;
  3199.         CloseMenu(G_Above_message.msg_id, G_Above_message.collection_id);
  3200.         }
  3201.         else
  3202.         {
  3203.         G_Above_message.mustshown = true;
  3204.         OpenMenu(G_Above_message.msg_id, G_Above_message.collection_id);
  3205.         }
  3206.     }
  3207.     
  3208. function OnPopupContextMenu()
  3209.     {
  3210. //    alert('OnPopupContextMenu()');
  3211.     }
  3212.     
  3213. function LeadUp(msg_id, CollectionID)
  3214.     {
  3215.     if((G_Above_message.msg_id != msg_id) || (G_Above_message.collection_id !=CollectionID))
  3216.         {
  3217.         G_Above_message.mustshown = true;
  3218.         }
  3219.     }
  3220.  
  3221. //    ------------------------------------------------------------------------------------------
  3222. //    alert("open menu - middle item for association");
  3223. //    ------------------------------------------------------------------------------------------
  3224. function OpenMenu(msg_id, CollectionID)
  3225.     {    
  3226.     if((G_Above_message.collection_id == CollectionID) && (G_Above_message.msg_id == msg_id) && 
  3227.        (G_Above_message.mustshown == true) &&             (G_Shown_message.msg_id != msg_id))
  3228.         {
  3229.         CloseMenu(G_Shown_message.msg_id, G_Shown_message.collection_id);
  3230.         
  3231.         // Get first element with specific ID
  3232.         var Collection_element = document.getElementById(CollectionID+'_container'); if (Collection_element == null) return;
  3233.         //    Get the message by ID
  3234.         var Msg_element = Collection_element.all[msg_id];
  3235.         //-----------------------------------------------------------------------------------------
  3236.         // New added for menu of deleted item
  3237.         if (Msg_element == null) return;
  3238.         //-----------------------------------------------------------------------------------------
  3239.         //    Set the class for message
  3240.         Msg_element.className = Msg_element.className+" Exp";        
  3241.         // if item must be shown
  3242.         if(Msg_element.msg_type == '2')
  3243.             {
  3244.             var Base_up_element = Msg_element.all["Base_"+msg_id];
  3245.             var Base_down_element = Base_up_element;
  3246.             }
  3247.             else
  3248.             {
  3249.             var Base_up_element = Msg_element.all["Base_up_"+msg_id];
  3250.             var Base_down_element = Msg_element.all["Base_down_"+msg_id];
  3251.             }
  3252.  
  3253.         // if it must to do nothing    ---------------------------------------------------------------------------------------------
  3254.         if(Msg_element.if_dont_sync == 'true')     var picture = "Pics/Radio_no_active.gif";
  3255.         else                                     var picture = "Pics/Radio_no_unactive.gif";
  3256.  
  3257.         var MsgObj = external.ObjByID(msg_id);
  3258.         var solution = MsgObj.GetObjM('m_SolutionWPtr');
  3259.         var Dont_sync_pic = '<img src="'+picture+'" onclick=OnArrowClick("'+    
  3260.                             solution.objID+'","'+CONST_WIN_NO_SYNC+'") style="cursor:hand" title="'+external.LS('hint_Winner_Nothing')+'">';
  3261.         // if it must to delete all    ---------------------------------------------------------------------------------------------        
  3262.         if(Msg_element.if_del_sync == 'true')     var picture = "Pics/Radio_del_active.gif";
  3263.         else                                     var picture = "Pics/Radio_del_unactive.gif";
  3264.  
  3265.         var MsgObj = external.ObjByID(msg_id);
  3266.         var solution = MsgObj.GetObjM('m_SolutionWPtr');
  3267.         var Del_sync_pic = '<img src="'+picture+'" onclick=OnArrowClick("'+    
  3268.                             solution.objID+'","'+CONST_WIN_DEL_SYNC+'") style="cursor:hand" title="'+external.LS('hint_Winner_Delete_All')+'">';            
  3269.         //  -------------------------------------------------------------------------------------------------------------------------
  3270.         
  3271.         var Up_plate = document.createElement("div");
  3272.         var Down_plate = document.createElement("div");
  3273.         
  3274.         Base_down_element.className = 'Back_plate1';
  3275.         Base_up_element.appendChild(Up_plate);
  3276.         Base_down_element.appendChild(Down_plate);
  3277.         
  3278.         Up_plate.id = 'Up_plate';
  3279.         Up_plate.className = "Up_plate_style_"+Msg_element.msg_type;
  3280.         Up_plate.innerHTML = '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="MsgPopupCaption" width="100%" align="center">'+external.LS('popup_menu_select')+'</td></tr></table>';
  3281.         
  3282.         Down_plate.id = 'Down_plate';
  3283.         Down_plate.className = "Down_plate_style_"+Msg_element.msg_type;
  3284.         Down_plate.innerHTML =     '<table width="100%" cellspacing="0" cellpadding="0">'+
  3285.                                     '<tr>'+
  3286.                                         '<td class="Down_plate_cell" style="padding-left:5px;">'+
  3287.                                             '<span class="More_ref" onclick="OnUserMsgMoreButtonClick(\''+msg_id+'\', \''+CollectionID+'\')">'+
  3288.                                                 external.LS('popup_menu_more')+
  3289.                                             '</span>'+
  3290.                                         '</td>'+
  3291.                                         '<td width="100%" class="Down_plate_cell">'+
  3292.                                             '<img src="Pics/Dot.gif">'+
  3293.                                             Dont_sync_pic+
  3294.                                         '</td>'+
  3295.                                         '<td class="Down_plate_cell" style="padding-right:7px;">'+
  3296.                                             Del_sync_pic+'</td>'+
  3297.                                     '</tr>'+
  3298.                                 '</table>';
  3299.         //    -------------------------------------------------------------------------------------------------------------------------
  3300.         G_Shown_message.msg_id = msg_id;
  3301.         G_Shown_message.collection_id = CollectionID;
  3302.         }
  3303.     }
  3304.  
  3305. function CloseMenu(msg_id, CollectionID)
  3306.     {
  3307.     Aboveflag = (G_Above_message.collection_id == CollectionID)&&(G_Above_message.msg_id == msg_id);
  3308.     if((!Aboveflag || (G_Above_message.mustshown == false))&&(G_Shown_message.msg_id == msg_id) && (G_Shown_message.collection_id == CollectionID) && (G_Shown_message.msg_id != null))
  3309.         {
  3310.         // find string in collection
  3311.         var Collection_element = document.getElementById(CollectionID+'_container');
  3312.         if(Collection_element == null)
  3313.             {
  3314.             return;
  3315.             }
  3316.         // find message for(in) element    
  3317.         var Msg_element = Collection_element.all[msg_id];
  3318.         if(Msg_element == null)
  3319.             {
  3320.             return;
  3321.             }
  3322.         //    change view to normal    
  3323.         Msg_element.className = Msg_element.className.replace(/ Exp/,"");
  3324.         
  3325.         //    find up_plate in message
  3326.         var Up_plate = Msg_element.all["Up_plate"];
  3327.         if(Up_plate == null)    return;
  3328.         else                     Up_plate.outerHTML = '';// Up_plate.removeNode(true);        
  3329.         //    find Down_plate in message
  3330.         var Down_plate = Msg_element.all["Down_plate"];
  3331.         if(Down_plate == null)    return;            
  3332.         else                     Down_plate.outerHTML = '';// Down_plate.removeNode(true);
  3333.         
  3334.         //    change to normal state
  3335.         if(Msg_element.msg_type == '2')    Base_down_element = Msg_element.all["Base_"+msg_id];
  3336.         else                            Base_down_element = Msg_element.all["Base_down_"+msg_id];
  3337.             
  3338.         Base_down_element.className = 'Back_plate';
  3339.         G_Shown_message.msg_id = null;
  3340. //                Debug_shown_msg.innerText = 'null';
  3341.         G_Shown_message.collection_id = null;
  3342. //                Debug_shown_collection.innerText = 'null';
  3343.         }
  3344.     }    
  3345.  
  3346. function AddTreeToAssoc()
  3347.     {
  3348.     var AssocObj = external.ObjByID(G_ActiveAssocID);
  3349.     AssocObj.Method0('M_CreateNewSyncTreeInAssoc');
  3350. //    ExtOnAssocChanged(G_ActiveAssocID);
  3351.     ExtOnProfileChanged();
  3352.     }
  3353.     
  3354. function DeleteTreeFromAssoc(AssocID, SuperTreeID)
  3355.     {
  3356.     var AssocObj = external.ObjByID(AssocID);
  3357.     var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  3358.     var SuperTree = SuperTreeList.ObjByID(SuperTreeID);
  3359.     SuperTreeList.Method1('M_RemoveKey', SuperTree);
  3360.     ExtOnProfileChanged();
  3361.     }
  3362.  
  3363. function OnUserMsgMoreButtonClick(MessageID, CollectionID)
  3364.     {
  3365.     window.event.cancelBubble = true;
  3366.     G_Above_message.latch = true;
  3367.     var MessageObj = external.ObjByID(MessageID);
  3368.     var Solution = MessageObj.GetM('m_SolutionWPtr');
  3369.     external.ShowContextMenu(Solution, CollectionID);
  3370.     G_Above_message.latch = false;
  3371.     return;
  3372.     }
  3373.     
  3374. function CapMenuLinkClick()
  3375.     {
  3376.     if(G_Caption_menu == false)
  3377.         {
  3378.         G_Caption_menu_mustshown = true;
  3379.         G_Caption_menu_above = true;
  3380.         Hint_window.style.visibility = 'hidden';
  3381.         Change_link_container.style.visibility = 'hidden';
  3382.         OpenCaptionMenu();
  3383.         var Assoc_element = document.getElementById('Assoc_'+G_ActiveAssocID);
  3384.         Assoc_element.all['TopCapRadioLeft'].children[0].focus();
  3385.         }
  3386.     }
  3387.  
  3388. function CapMenuClick()
  3389.     {
  3390.     if(G_Caption_menu == false)
  3391.         {
  3392.         CapMenuLinkClick();
  3393.         }
  3394.         else
  3395.         {
  3396.         G_Caption_menu_mustshown = false;
  3397.         CloseCaptionMenu();
  3398.         }
  3399.     }
  3400.  
  3401. function CapMenuFocusIn()
  3402.     {
  3403. //    Debug_window.innerHTML = 'CapMenuFocusIn(): '+window.event.srcElement.tagName+'<br>'+Debug_window.innerHTML;
  3404.     G_FocusInCaptionMenu = true;
  3405.     }
  3406.     
  3407. function CapMenuFocusOut()
  3408.     {
  3409. //    Debug_window.innerHTML = 'CapMenuFocusOut(): '+window.event.srcElement.tagName+' to '+event.toElement.tagName+'<br>'+Debug_window.innerHTML;
  3410.     if(G_Block == false)
  3411.         {
  3412.         G_FocusInCaptionMenu = false;
  3413.         window.setTimeout("HandleCaptionMenu()", 10);
  3414.         }
  3415.         else
  3416.         {
  3417.         G_Block = false;
  3418.         }
  3419.     }
  3420.     
  3421. function HandleCaptionMenu()
  3422.     {
  3423.     if(G_FocusInCaptionMenu == false)
  3424.         {
  3425. //        Debug_window.innerHTML = 'HandleCaptionMenu() before close<br>'+Debug_window.innerHTML;
  3426.         G_Caption_menu_mustshown = false;
  3427.         CloseCaptionMenu();
  3428.         }
  3429.     }
  3430.     
  3431. function CapMenuEnter()
  3432.     {
  3433.     G_Caption_menu_above = true;
  3434. //    G_Caption_menu_mustshown = true;
  3435.     window.setTimeout("OpenCaptionMenu()", 10);
  3436.     }
  3437.     
  3438. function CapMenuLeave()
  3439.     {
  3440. //    Debug_window.innerHTML = 'CapMenuLeave()<br>'+Debug_window.innerHTML;
  3441.     G_Caption_menu_above = false;
  3442.     window.setTimeout("CloseCaptionMenu()", 10);
  3443.     }
  3444.     
  3445. function OpenCaptionMenu()
  3446.     { 
  3447. //    Debug_window.innerHTML = 'OpenCaptionMenu: G_Caption_menu_above = '+G_Caption_menu_above+'; G_Caption_menu = '+G_Caption_menu+' G_Caption_menu_mustshown = '+G_Caption_menu_mustshown+'<br>'+Debug_window.innerHTML;
  3448.     if((G_Caption_menu_above == true)&&(G_Caption_menu_mustshown == true))
  3449.         {
  3450.         AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3451.         SyncBoardsTable_element = AssocElement.all['SyncBoardsTable'];
  3452.         SyncBoardsTable_element.className = 'Exp';
  3453.         if(G_Assocs[G_ActiveAssocID].WinningSuperTreeID == CONST_CID)
  3454.             {
  3455.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way.gif';
  3456.             }
  3457.             else
  3458.             {
  3459.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way_unactive.gif';
  3460.             }
  3461.         var AssocObj = external.ObjByID(G_ActiveAssocID);
  3462.         If_remove_check.checked = AssocObj.Method0('M_GetMimicDeleted');
  3463.         If_rewrite_check.checked = AssocObj.Method0('M_GetMimicChanged');
  3464.         Caption_up_plate.style.visibility = 'visible';
  3465.         Caption_down_plate.style.visibility = 'visible';
  3466.         G_Caption_menu = true;
  3467.         }
  3468.     }
  3469.  
  3470. function CloseCaptionMenu()
  3471.     {
  3472.     if((G_Caption_menu_above == false)||((G_Caption_menu == true)&&(G_Caption_menu_mustshown == false)))
  3473.         {
  3474.         AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3475.         SyncBoardsTable_element = AssocElement.all['SyncBoardsTable'];
  3476.         //----------------------------------------------------------------------------------------------------------------
  3477.         var state = 'Normal_State';
  3478.         var AssocObj = external.ObjByID(G_ActiveAssocID);    
  3479.         if        ((1 == AssocObj.Method1('M_GetStatusAttribute', STATUS_ATTRIBUTE_ANALYZING))    &&    
  3480.                  (0 == AssocObj.Method1('M_GetStatusAttribute', STATUS_ATTRIBUTE_INFORMATION_MESSAGE)) &&
  3481.                  (0 == AssocObj.Method1('M_GetStatusAttribute', STATUS_ATTRIBUTE_IMPORTANT_MESSAGE))) state = 'Analyze_State';
  3482.         else if  (1 == AssocObj.Method1('M_GetStatusAttribute', STATUS_ATTRIBUTE_SYNCHRONIZING    ))    state = 'Sync_State';
  3483.         SyncBoardsTable_element.className = state;
  3484.         //----------------------------------------------------------------------------------------------------------------
  3485.         Change_link_container.style.visibility = 'visible';
  3486.         Caption_up_plate.style.visibility = 'hidden';
  3487.         Caption_down_plate.style.visibility = 'hidden';
  3488.         G_Caption_menu = false;
  3489.         G_Caption_menu_mustshown = false;
  3490.         }
  3491.     }
  3492.  
  3493. function ResizeWindow()
  3494.     {
  3495.     var AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3496.     if(AssocElement == null)
  3497.         {
  3498.         return;
  3499.         }
  3500.     if(Hint_window.hint_number != '')
  3501.         {
  3502.         var element =  AssocElement.all["TreePath"+Hint_window.hint_number];
  3503.         PlaceHintWindow(element, Hint_window.hint_number);
  3504.         }
  3505.     
  3506.     var _left = 285;
  3507.     var element1 = AssocElement.all["SyncBoardsTable"];
  3508.     var _width = element1.offsetWidth - 590;
  3509.     var _top_h = element1.offsetHeight;
  3510.     var _top = 0;
  3511.     while(element1.tagName!= 'BODY')
  3512.         {
  3513.         _left += element1.offsetLeft;
  3514.         _top += element1.offsetTop;
  3515.         element1 = element1.offsetParent;
  3516.         }
  3517.  
  3518.     //if(document.SyncBoardsTable != null)// New
  3519.         {
  3520.         var _center = (_width/2)+_left;
  3521.         
  3522.         Change_link_container.style.left = _left+30;
  3523.         Change_link_container.style.width = _width-40;
  3524.         Change_link_container.style.top = _top+17;
  3525.         
  3526.         //Caption_up_plate.style.left = _left+1;
  3527.         //Caption_up_plate.style.width = _width-2;
  3528.         Caption_up_plate.style.left = _center-105;
  3529.         Caption_up_plate.style.width = 230;
  3530.  
  3531.         var _top_up = Caption_up_plate.offsetHeight;
  3532.         Caption_up_plate.style.top = _top-_top_up;
  3533.     
  3534.         //Caption_down_plate.style.left = _left;
  3535.         //Caption_down_plate.style.width = _width;
  3536.         Caption_down_plate.style.left = _center-106;
  3537.         Caption_down_plate.style.width = 232;
  3538.  
  3539.         Caption_down_plate.style.top = _top+_top_h;
  3540.         }
  3541.     }
  3542.     
  3543. function ManualOn()
  3544.     {
  3545.     AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3546.     AssocElement.all['Manual_switch'].className = 'Switch_control_active';
  3547.     AssocElement.all['Auto_switch'].className = 'Switch_control_unactive';
  3548.     AssocElement.all['Control_buttons_panel'].innerHTML = Manual_template.innerHTML;
  3549. //---------------------    
  3550.     AssocElement.all['B_ANALYZE'].innerText = external.LS("button_analyze");
  3551.     AssocElement.all['B_ANALYZE'].title = external.LS("tooltip_Analyze_button");
  3552.       AssocElement.all['B_ANALYZE'].association_id = AssocID;
  3553.     AssocElement.all['B_SYNC'].innerText = external.LS("button_synchronize");
  3554.     AssocElement.all['B_SYNC'].title = external.LS("tooltip_Sinchronize_button");
  3555.     AssocElement.all['B_SYNC'].association_id = AssocID;
  3556.     AssocElement.all['B_STOP'].innerText = external.LS("button_stop");
  3557.       AssocElement.all['B_STOP'].title = external.LS("tooltip_Stop_button");
  3558.     AssocElement.all['B_STOP'].association_id = AssocID;
  3559.     AssocElement.all['Important_warning_text'].innerText = external.LS("important_warning");
  3560.       AssocElement.all['Important_warning'].title = external.LS("tooltip_Important_warning");
  3561.     UpdateButtons(G_ActiveAssocID);
  3562.     }
  3563.     
  3564. function AutoOn()
  3565.     {
  3566.     AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3567.     AssocElement.all['Manual_switch'].className = 'Switch_control_unactive';
  3568.     AssocElement.all['Auto_switch'].className = 'Switch_control_active';
  3569.     AssocElement.all['Control_buttons_panel'].innerHTML = Auto_template.innerHTML;
  3570.     }    
  3571.  
  3572. function CapRadioHandler(AssocID, SuperTreeID)    //For DU: Used if one way sync turn on
  3573.     {
  3574.     window.event.cancelBubble = true;
  3575.     G_Assocs[AssocID].WinningSuperTreeID = SuperTreeID;
  3576.     var AssocObj = external.ObjByID(AssocID);
  3577.  
  3578.     G_AssocChangedCause = 'SyncDirectionChanged';
  3579.     AssocObj.Method1ID('M_SetSyncDirection', SuperTreeID);    //For DU: set one way sync
  3580.     G_AssocChangedCause = '';
  3581.     }
  3582.  
  3583. function CapAllWayOn()    //For DU: Used if one way sync turn off
  3584.     {
  3585.     window.event.cancelBubble = true;
  3586.     G_Assocs[G_ActiveAssocID].WinningSuperTreeID = CONST_CID;
  3587.     var AssocObj = external.ObjByID(G_ActiveAssocID);
  3588.     G_AssocChangedCause = 'SyncDirectionChanged';
  3589.     AssocObj.Method1ID('M_SetSyncDirection', 'DIRECTION_ALL_WAY');    //For DU: set all way sync
  3590.     G_AssocChangedCause = '';
  3591.     //DU: we'll get an event about paths has changed. LoadAssocPaths(G_ActiveAssocID);
  3592.     }
  3593.  
  3594. function CaptionCheckBoxClick(element)
  3595.     {
  3596. //    Debug_window.innerHTML = 'CaptionCheckBoxClick()<br>'+Debug_window.innerHTML;
  3597.     window.event.cancelBubble = true;
  3598.     var AssocObj = external.ObjByID(G_ActiveAssocID);
  3599.     if(element.id == "If_remove_check")
  3600.         {
  3601.         G_AssocChangedCause = 'Propagate_set';
  3602.         AssocObj.Method1('M_SetMimicDeleted', element.checked);
  3603.         G_AssocChangedCause = '';
  3604.         }
  3605.     else if(element.id == "If_rewrite_check")
  3606.         {
  3607.         G_AssocChangedCause = 'Propagate_set';
  3608.         AssocObj.Method1('M_SetMimicChanged', element.checked);
  3609.         G_AssocChangedCause = '';
  3610.         }
  3611.     }
  3612.     
  3613.  
  3614. function CaptionLabelClick(element)
  3615.     {
  3616. //    Debug_window.innerHTML = 'CaptionLabelClick()<br>'+Debug_window.innerHTML;
  3617.     window.event.cancelBubble = true;
  3618.     }
  3619.  
  3620. function BlockFocusOut()
  3621.     {
  3622.     G_Block = true;
  3623. //    Debug_window.innerHTML = 'BlockFocusOut()<br>'+Debug_window.innerHTML;
  3624.     }
  3625.  
  3626. function ButtonContextMenu()
  3627.     {
  3628.     window.event.cancelBubble = true;
  3629.     }
  3630.  
  3631. function StopContextMenu()
  3632.     {
  3633.     window.event.cancelBubble = true;
  3634.     }
  3635.  
  3636. function Debug()
  3637.     {
  3638. //    G_Block = true;
  3639. //    Debug_window.innerHTML = 'Debug()<br>'+Debug_window.innerHTML;
  3640. //    AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3641. //    external.StrToDebugFile(AssocElement.outerHTML);
  3642.     }
  3643. function OnMouseOverPath()
  3644.     {        
  3645.         event.srcElement.className = "VisitedItem";                
  3646.     }
  3647.     
  3648. function OnMouseOutPath()
  3649.     {        
  3650.         event.srcElement.className = "";        
  3651.     }    
  3652. //----------------------------------------------------------------------------------------------------------------------
  3653. // this.build_root=function()
  3654. // this.build_collection=function(CollectionID)
  3655. // this.build_message=function(CollectionID, MsgID, MsgEvenness)
  3656. // this.redraw=function()                                              // function redraws whole treeview
  3657. // this.redraw_collection=function(CollectionID)
  3658. //----------------------------------------------------------------------------------------------------------------------
  3659. function CreateTree(AssocID, name,    spanid) // main TreeView object
  3660. {
  3661.     //--------------------------------------------------------------------------------------------------------------------
  3662.     this._name                     =    name;       // name of object                         : "tree"
  3663.     this._spanid                =    spanid;     // id of existing div used for treeview : "TreeView_element" link to code of container
  3664.       this._associationID         =     AssocID;    //    link to association
  3665.     this._collections             =    {};         //    new Array(); that will contain collections
  3666.     this._collectionIdByName     =     {};         //    new Array(); that will contain names of collections    
  3667.     
  3668.     this._image_collapsed="Pics/collapsed.gif";    // image for parent nodes    when they are collapsed
  3669.       this._image_expanded="Pics/expanded.gif";    // image for parent nodes    when they are expanded
  3670.     
  3671.       this.root    =                                // main node properties
  3672.                 {    
  3673.                 _id:name+"_root",               // name            
  3674.                  _childrencount:0,                // quantity of children
  3675.                  _children:[]                      // children array
  3676.                 };
  3677. //------------------------------------------------------------------------------------------------------------------
  3678. // (R)     
  3679.   this.build_root=function()                    //    
  3680.       {
  3681.     var html_code = '<div id="'+this.root._id+'" >\n';    
  3682.     html_code += '<table width="100%" cellpadding="0" cellspacing="0" border="0">';
  3683.     
  3684.     for(i in this.root._children)        
  3685.         html_code += '<tr><td>'+this.build_collection(i)+'</td></tr>';
  3686.         
  3687.     html_code += '</table></div>';
  3688.     return html_code;
  3689.     };
  3690.     
  3691. //    (R) build interface collection from core collection
  3692. this.build_collection=function(CollectionID)
  3693. {
  3694. //-----------------------------------------------------------------------------------------
  3695. var collection                 = this.root._children[CollectionID];
  3696. var msgs                     = this._collections[CollectionID].obj;
  3697. var CollectionChildrenCount = msgs.Method0('M_GetCount');
  3698. //-----------------------------------------------------------------------------------------    
  3699. var Important_sign             = '';
  3700. var sub_collection_html     = '';
  3701. var collection_html         = ''; 
  3702. //-----------------------------------------------------------------------------------------
  3703. var MsgScrollersExist         = false;
  3704. var Prev_html                = '';
  3705. var Next_html                 = '';
  3706. var Prev_exist                = false;
  3707. var Next_exist                = false;
  3708. var i                        = 0;
  3709. var msg                     = null;
  3710. //-----------------------------------------------------------------------------------------
  3711. if(this._collections[CollectionID].name == 'Important') 
  3712.     {
  3713.     var AssocElement = document.getElementById('Assoc_'+this._associationID);
  3714.     AssocElement.all['Important_warning'].style.visibility = "hidden";
  3715.         
  3716.     if(CollectionChildrenCount > 0)
  3717.         {            
  3718.         AssocElement.all['Important_warning'].style.visibility = "inherit";
  3719.         Important_sign = '<span><img src="Pics/warning_small.gif"></span> ';
  3720.         }        
  3721.     }    
  3722. //-----------------------------------------------------------------------------------------    
  3723. collection_html+='<div id="'+CollectionID+'" class="Collection_class" onmousewheel="return scrollIt(\''+CollectionID+'\');">'; 
  3724.  
  3725. if (CollectionChildrenCount == 0) 
  3726.     {
  3727.     collection._empty = true;
  3728.     }
  3729. else //if (CollectionChildrenCount  > 0)
  3730.     {    
  3731.     collection._empty = false;
  3732.  
  3733.     if(collection._expanded == 1)
  3734.         {    
  3735.         if (CollectionChildrenCount > external.Method1('M_GetGlobalOption', 'ItemsPerPage')) MsgScrollersExist = true;             
  3736.         //----------------------------------------------------------------------------------------                                                        
  3737.         msg = msgs.GetFirst();  
  3738.         var firstVisibleMsgID = (msgs.Method0('M_GetFirstVisibleMessage')).objID;        
  3739.         if (firstVisibleMsgID != msg.objID) {Prev_exist = true; }                    
  3740.         else                                 {Prev_exist = false;} 
  3741.         Prev_html = new CreateScrollControls("prev", Prev_exist, CollectionID, MsgScrollersExist);
  3742.         //----------------------------------------------------------------------------------------                    
  3743.         var MsgEvenness    = 1 - collection._first_disp_msg_evenness;                            
  3744.         msg = msgs.Method0('M_GetFirstVisibleMessage');                
  3745.         if (msg != null) var lastVisibleMsgID = msg.objID;
  3746.         while (msg != null)    
  3747.             {
  3748.             MsgEvenness = 1 - MsgEvenness;
  3749.             sub_collection_html += this.build_message(CollectionID, msg.objID, MsgEvenness);            
  3750.             msg = msgs.Method1('M_GetNextVisibleMessage', msg);
  3751.             if (msg != null) lastVisibleMsgID = msg.objID;            
  3752.             }                
  3753.         //----------------------------------------------------------------------------------------                    
  3754.         msg = msgs.GetLast();
  3755.         if (lastVisibleMsgID  != msg.objID) {Next_exist = true; }                    
  3756.         else                                 {Next_exist = false;}
  3757.         Next_html = new CreateScrollControls("next", Next_exist, CollectionID, MsgScrollersExist);
  3758.         //----------------------------------------------------------------------------------------                    
  3759.             
  3760.         //-----------------------------------------------------------------------------------------------
  3761.                          //--------- Collection header area begin ---------------------------------------
  3762.                          //------------------------------------------------------------------------------
  3763.         collection_html+='\n' +
  3764.                          '<div id="'+CollectionID+'_in" style="width:100%; position:relative; left:0;">'+
  3765.                          '\n'+
  3766.                          '<table class="ParentNode" border="0" cellpadding="0" cellspacing="0">'+
  3767.                              '<tr>'+
  3768.                                  '<td valign=middle align=center oncontextmenu="StopContextMenu()">'+
  3769.                                         '<div style="width:30px;"><img onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" src="'+
  3770.                                         this._image_expanded+'">'+
  3771.                                         '</div>'+
  3772.                                     '</td>'+
  3773.                                     '<td oncontextmenu="StopContextMenu()" nowrap>'+    
  3774.                                      '<span tabindex="4" onkeypress="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" '+
  3775.                                      'class="CollectionName" onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" '+
  3776.                                      'style="cursor:hand;" title="'+external.LS('tooltip_'+this._collections[CollectionID].name+'_collection')+'">'+
  3777.                                      Important_sign+collection._caption+' (<span id="'+ CollectionID+'_caption">'+CollectionChildrenCount+'</span>) '+ 
  3778.                                      '</span>';                          
  3779.         collection_html+=        '</td>'+
  3780.                                 
  3781.                                 '<td width="100%" align="left">'+                             '</td>'+         
  3782.                                  '<td id="TopPrev_end" valign="bottom" >'+Prev_html.top_end+'</td>'+
  3783.                                  '<td id="TopPrev_page" valign="bottom" >'+Prev_html.top_page+'</td>'+
  3784.                                  '<td id="TopPrev_msg" valign="bottom" >'+Prev_html.top_msg+'</td>'+
  3785.                                  '<td id="TopNext_msg" valign="bottom" >'+Next_html.top_msg+'</td>'+
  3786.                                  '<td id="TopNext_page" valign="bottom" >'+Next_html.top_page+'</td>'+
  3787.                                  '<td id="TopNext_end" valign="bottom" >'+Next_html.top_end+'</td>'+
  3788.                              '</tr>'+
  3789.                          
  3790.                          '</table>'+
  3791.                          '</div>'+
  3792.                          '\n';
  3793.                          //------------------------------------------------------------------------------
  3794.                          //--------- Collection header area end -----------------------------------------
  3795.                          //------------------------------------------------------------------------------
  3796.                          
  3797. //----------------------------------------------------------------------------------------------------------------------------------------------------
  3798. // Collection area begin -----------------------------------------------------------------------------------------------------------------------------
  3799. //----------------------------------------------------------------------------------------------------------------------------------------------------
  3800.         collection_html +=  '<div style="position: relative;"> '+ //----------------------------------------------------------------------------------
  3801. //----------------------------------------------------------------------------------------------------------------------------------------------------
  3802.                             '<table class="MessageList" border="0" cellspacing="0" cellpadding="0">'+
  3803.                                 '<tr>'+
  3804.                                     '<td class="MsgCollectionScrollBar" style="width:16px; height:100%;">'+
  3805.                                         //-----------------------------------------------------------------
  3806.                                         '<table height="100%" style="background:#88BAC8;" width="16px" border="0" cellpadding="0" cellspacing="0" id="'+CollectionID+'_ScrollBar">'+
  3807.                                             '<tr><td height="15px" style="border: solid 1px #787864; border-right: none; border-bottom: none; background:#88BAC8;">'+'<img src="Pics/Dot.gif">'+'</td></tr>'+
  3808.                                             '<tr><td id="Prev_end" style="padding-top: 1px; border-left: solid 1px #787864;">'        + Prev_html.end+'</td></tr>'+
  3809.                                             '<tr><td id="Prev_page" style="padding-top: 1px; border-left: solid 1px #787864;">'        + Prev_html.page+'</td></tr>'+
  3810.                                             '<tr><td id="Prev_msg" style="padding-top: 1px; border-left: solid 1px #787864;">'        + Prev_html.msg+'</td></tr>';                                    
  3811.         collection_html +=                    '<tr><td id="Scroll_all" style="padding-top: 1px; border-left: solid 1px #787864;">'    + Prev_html.scroll + '</td></tr>';                            
  3812.         collection_html +=                    '<tr><td id="Next_msg" style="padding-top: 1px; border-left: solid 1px #787864;">'        + Next_html.msg+'</td></tr>'+
  3813.                                             '<tr><td id="Next_page" style="padding-top: 1px; border-left: solid 1px #787864;">'        + Next_html.page+'</td></tr>'+
  3814.                                             '<tr><td id="Next_end" style="padding-top: 1px; border-left: solid 1px #787864;">'        + Next_html.end+'</td></tr>'+
  3815.                                             '<tr height="100%"><td height="100%" style="border: solid 1px #787864; border-top: none; border-right: none; background:#88BAC8;">'+'<img src="Pics/Dot.gif">'+'</td></tr>'+
  3816.                                         '</table>'+
  3817.                                         //----------------------------------------------------------------                                                
  3818.                                     '</td>';
  3819.         collection_html +=             '<td width="100%">';
  3820.  
  3821. //--------------------------------------------------------------------------------------------
  3822. if(this._collections[CollectionID].name != 'Important') // Begin not for Important collection    speed is fine
  3823.     {
  3824.     //----------------------------------------------------------------------------------------------------------------------------------------------------
  3825.     var New_Sort_Info = 'Sort_by_default';
  3826.     //----------------------------------------------------
  3827.     var msgs = external.ObjByID(CollectionID);
  3828.     var Last_Sort_ID = msgs.Method0('M_GetSortingCriterion'); 
  3829.     var TreeID = msgs.Method0('M_GetSortingTree');
  3830.     //----------------------------------------------------
  3831.     var AssocObj = external.ObjByID(G_ActiveAssocID);
  3832.     var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  3833.     var SuperTree_Obj = SuperTreeList.GetFirst();
  3834.     var Tree_0_ID = SuperTree_Obj.objID;
  3835.     SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  3836.     var Tree_1_ID = SuperTree_Obj.objID;
  3837.     //-----------------------------------------------------------------------------------------------
  3838.     if         ((Last_Sort_ID == '646E6563736544435174726F53676E69') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_name_down_1';}
  3839.     else if ((Last_Sort_ID == '69646E6563734143464974726F53676E') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_name_up_1';}
  3840.     else if ((Last_Sort_ID == '646E6563736544436B74726F53676E69') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_size_down_1';}
  3841.     else if ((Last_Sort_ID == '69646E6563734143604974726F53676E') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_size_up_1';}
  3842.     else if ((Last_Sort_ID == '646E6563736544435F74726F53676E69') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_time_down_1';}
  3843.     else if ((Last_Sort_ID == '69646E6563734143544974726F53676E') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_time_up_1';}
  3844.     //-----------------------------------------------------------------------------------------------    
  3845.     else if ((Last_Sort_ID == '646E6563736544435174726F53676E69') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_name_down_2';}
  3846.     else if ((Last_Sort_ID == '69646E6563734143464974726F53676E') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_name_up_2';}
  3847.     else if ((Last_Sort_ID == '646E6563736544436B74726F53676E69') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_size_down_2';}
  3848.     else if ((Last_Sort_ID == '69646E6563734143604974726F53676E') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_size_up_2';}
  3849.     else if ((Last_Sort_ID == '646E6563736544435F74726F53676E69') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_time_down_2';}
  3850.     else if ((Last_Sort_ID == '69646E6563734143544974726F53676E') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_time_up_2';}    
  3851.     //-----------------------------------------------------------------------------------------------
  3852.     else if ((Last_Sort_ID == '646E6563736544434374726F53676E69')) {New_Sort_Info = 'Sort_by_winner_down';}
  3853.     else if ((Last_Sort_ID == '69646E6563734143744974726F53676E')) {New_Sort_Info = 'Sort_by_winner_up';}            
  3854. //-----------------------    
  3855.     var    NameItem1 = external.LS("sort_name_item");
  3856.     var    NameItem2 = external.LS("sort_name_item");    
  3857. //-----------------------    
  3858.     var    SizeItem1 = '<span style="width:40px;"> ' + external.LS("sort_size_item") + '</span>';
  3859.     var    SizeItem2 = '<span style="width:40px;"> ' + external.LS("sort_size_item") + '</span>';
  3860. //-----------------------    
  3861.     var    TimeItem1 = '<span style="width:90px"> ' + external.LS("sort_time_item") + '</span>';
  3862.     var    TimeItem2 = '<span style="width:90px"> ' + external.LS("sort_time_item") + '</span>';                
  3863. //-----------------------    
  3864.     var    WinnerItem = '<span style="width:98px"> ' + external.LS("sort_winner_item") + '</span>';
  3865. //-----------------------    
  3866.     if         (New_Sort_Info == 'Sort_by_name_up_1'  )    NameItem1 = '<img src="Pics/Sort_Up.gif"> ' + external.LS("sort_name_item");
  3867.     else if (New_Sort_Info == 'Sort_by_name_up_2'  )    NameItem2 = '<img src="Pics/Sort_Up.gif"> ' + external.LS("sort_name_item");    
  3868.     else if (New_Sort_Info == 'Sort_by_name_down_1')    NameItem1 = '<img src="Pics/Sort_Down.gif"> ' + external.LS("sort_name_item");
  3869.     else if (New_Sort_Info == 'Sort_by_name_down_2')    NameItem2 = '<img src="Pics/Sort_Down.gif"> ' + external.LS("sort_name_item");
  3870. //-----------------------
  3871.     else if (New_Sort_Info == 'Sort_by_size_up_1'  )     SizeItem1 = '<span style="width:40px;"> <img src="Pics/Sort_Up.gif"> ' + external.LS("sort_size_item") + '</span>';
  3872.     else if (New_Sort_Info == 'Sort_by_size_up_2'  )    SizeItem2 = '<span style="width:40px;"> <img src="Pics/Sort_Up.gif"> ' + external.LS("sort_size_item") + '</span>';                
  3873.     else if (New_Sort_Info == 'Sort_by_size_down_1')    SizeItem1 = '<span style="width:40px;"> <img src="Pics/Sort_Down.gif"> ' + external.LS("sort_size_item") + '</span>';
  3874.     else if (New_Sort_Info == 'Sort_by_size_down_2')    SizeItem2 = '<span style="width:40px;"> <img src="Pics/Sort_Down.gif"> ' + external.LS("sort_size_item") + '</span>';    
  3875. //-----------------------
  3876.     else if (New_Sort_Info == 'Sort_by_time_up_1'  )    TimeItem1 = '<span style="width:90px"> <img src="Pics/Sort_Up.gif"> ' + external.LS("sort_time_item") + '</span>';
  3877.     else if (New_Sort_Info == 'Sort_by_time_up_2'  )    TimeItem2 = '<span style="width:90px"> <img src="Pics/Sort_Up.gif"> ' + external.LS("sort_time_item") + '</span>';
  3878.     else if (New_Sort_Info == 'Sort_by_time_down_1')    TimeItem1 = '<span style="width:90px"> <img src="Pics/Sort_Down.gif"> ' + external.LS("sort_time_item") + '</span>';
  3879.     else if (New_Sort_Info == 'Sort_by_time_down_2')    TimeItem2 = '<span style="width:90px"> <img src="Pics/Sort_Down.gif"> ' + external.LS("sort_time_item") + '</span>';
  3880. //-----------------------
  3881.     else if (New_Sort_Info == 'Sort_by_winner_up'  )     WinnerItem = '<span style="width:98px"> <img src="Pics/Sort_Up.gif"> ' + external.LS("sort_winner_item") + '</span>';        
  3882.     else if (New_Sort_Info == 'Sort_by_winner_down')     WinnerItem = '<span style="width:98px"> <img src="Pics/Sort_Down.gif"> ' + external.LS("sort_winner_item") + '</span>';                            
  3883. //-----------------------        
  3884.         collection_html +=    '<table id="'+CollectionID+'_sort_container" width="100%" border="0" cellspacing="0" cellpadding="0" class="Collection_Table" style="border-left: none;">'+    
  3885.                                 '<tr class="Single_row">'+                                 
  3886.                                      '<td id="'+CollectionID+'_sort_by_name_1" class="SyncAttrNameHead"    onclick="OnSortItemClick(\'name_1\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_name')  + '" width="50%" style="background:#88BAC8; cursor:hand; "> '    + NameItem1 + '</td>'+
  3887.                                      '<td id="'+CollectionID+'_sort_by_size_1" class="SyncAttrSizeHead"    onclick="OnSortItemClick(\'size_1\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_size')  + '" style="background:#88BAC8; cursor:hand;"> '         + SizeItem1 + '</td>'+
  3888.                                      '<td id="'+CollectionID+'_sort_by_time_1" class="SyncAttributeHead"   onclick="OnSortItemClick(\'time_1\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_time')  + '" nowrap style="background:#88BAC8; cursor:hand;"> '     + TimeItem1 + '</td>'+                                 
  3889.                                      '<td id="'+CollectionID+'_sort_by_winner" class="SyncWinnerItemHead"  onclick="OnSortItemClick(\'winner\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_winner')+ '" style="background:#88BAC8; cursor:hand;"> '         + WinnerItem + '</td>'+
  3890.                                      '<td id="'+CollectionID+'_sort_by_name_2" class="SyncAttrNameHead"    onclick="OnSortItemClick(\'name_2\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_name')  + '" width="50%" style="background:#88BAC8; cursor:hand;"> '      + NameItem2 + '</td>'+
  3891.                                      '<td id="'+CollectionID+'_sort_by_size_2" class="SyncAttrSizeHead"    onclick="OnSortItemClick(\'size_2\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_size')  + '" style="background:#88BAC8; cursor:hand;"> '         + SizeItem2 + '</td>'+
  3892.                                      '<td id="'+CollectionID+'_sort_by_time_2" class="SyncAttributeHead"   onclick="OnSortItemClick(\'time_2\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_time')  + '" nowrap style="background:#88BAC8; cursor:hand;"> '     + TimeItem2 + '</td>'+
  3893.                                  '</tr>'+                                                                   
  3894.                              '</table>';                             
  3895. //-------------------------------------------------------------------------------------------------------------------------------------------------------                             
  3896.     }        // End not for Important collection                     
  3897. //-------------------------------------------------------------------------------------------------------------------------------------------------------                             
  3898.         collection_html +=   '<table id="'+CollectionID+'_container" sub_id="'+CollectionID+'" '+
  3899.                              'width="100%" border="0" cellspacing="0" cellpadding="0" class="Collection_Table">'+
  3900.                                  sub_collection_html+
  3901.                              '</table>'+
  3902.                              '</td></tr></table></div>';         
  3903.         }
  3904.     else //if(collection._expanded == 0)
  3905.         {
  3906.         collection_html+='\n<div id="'+CollectionID+'_in" style="width:100%; position:relative; left:0;">\n'+
  3907.                         '<table class="ParentNode" border="0" cellpadding="0" cellspacing="0"><tr><td valign=middle align=center oncontextmenu="StopContextMenu()">'+
  3908.                             '<div style="width:30px;"><img  onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" src="'+this._image_collapsed+'"></div></td><td oncontextmenu="StopContextMenu()" nowrap>'+    
  3909.                          '<span tabindex="4" onkeypress="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" class="CollectionName" onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" style="cursor:hand;" title="'+external.LS('tooltip_'+this._collections[CollectionID].name+'_collection')+'">'+Important_sign+collection._caption+' (<span id="'+    
  3910.                          CollectionID+'_caption">'+CollectionChildrenCount+'</span>)</span> ';
  3911.         collection_html+='</td><td width="100%"></td></tr></table></div>\n';
  3912.         }
  3913.     }    
  3914. collection_html += '</div>\n\n';    
  3915. return collection_html;
  3916. };
  3917.  
  3918. //-----------------------------------------------------------------------------------------
  3919. // (R) 
  3920.   this.build_message=function(CollectionID, MsgID, MsgEvenness)
  3921.       {
  3922.     var msg = external.ObjByID(MsgID);
  3923.     message_html = FillMsgNode(msg, MsgEvenness, CollectionID); 
  3924.     return message_html;
  3925.     };
  3926.  
  3927. // (R) 
  3928.   this.redraw=function()  // function redraws whole treeview
  3929.   {
  3930.     var AssocElement = document.getElementById('Assoc_'+this._associationID);
  3931.     var ele = AssocElement.all[this._spanid];
  3932.     ele.innerHTML = this.build_root();
  3933.   };
  3934.  
  3935. // (R) 
  3936.   this.redraw_collection=function(CollectionID)
  3937.   {      
  3938.     var AssocElement = document.getElementById('Assoc_'+this._associationID);
  3939.       var collection_element = AssocElement.all[CollectionID];      
  3940.     if (collection_element != null)
  3941.           {
  3942.         collection_element.outerHTML = this.build_collection(CollectionID);    
  3943.         }
  3944.   };
  3945.  
  3946. // (R)           
  3947.   this.add_collection_node=function(msgs, collectionName, caption)      // adds node
  3948.   {    
  3949.   
  3950.       //if ((collectionName != 'Important') && (collectionName != 'All')) return;
  3951.     var CollectionID = msgs.objID;
  3952.     this._collections[CollectionID] = {};
  3953.     this._collections[CollectionID].obj = msgs;
  3954.     this._collections[CollectionID].name = collectionName;
  3955.     if (this._collections[CollectionID].sort == null) {this._collections[CollectionID].sort = 'sort_by_default';}
  3956.     this._collectionIdByName[collectionName] = CollectionID;
  3957.     var collection_node={};
  3958.     collection_node._caption=caption;
  3959.     
  3960.     // get collection state from core
  3961.     var expanded = this._collections[CollectionID].obj.Method0('M_GetCollectionState');        
  3962.     collection_node._expanded=expanded;    
  3963.     
  3964.     if(expanded == 1)     var NotifyFlag = true;
  3965.     else                 var NotifyFlag = false;
  3966.         
  3967.     if(msgs == null)
  3968.         {
  3969.         alert('add_collection_node: CollectionObj (msgs) == null');
  3970.         collection_node._empty = true;
  3971.         }
  3972.     else
  3973.         {
  3974.         var first_message = msgs.GetFirst();
  3975.         if(first_message == null)
  3976.             {
  3977.             collection_node._empty = true;
  3978.             }
  3979.             else
  3980.             {
  3981.             collection_node._first_disp_msg_evenness = 1;
  3982.             collection_node._empty = false;
  3983.             }
  3984.         } 
  3985.     this.root._childrencount++;
  3986.     this.root._children[CollectionID]=collection_node;
  3987.     return collection_node; 
  3988.   };
  3989. ///////////////////////////////////////////////////////////////////////////////////////////////////
  3990. this.add_message_node=function(CollectionID,MsgID,InsertPosition)      // adds node
  3991.       {
  3992.       if(this._collections[CollectionID] == null) return;
  3993.     var collection = this.root._children[CollectionID];
  3994.     var msgs = this._collections[CollectionID].obj;        
  3995.     if(msgs == null) alert('msgs == null');
  3996.     //--------------------------------------------------------------------------------------------    
  3997.     if(collection._empty == true) 
  3998.         {
  3999.         collection._empty = false; 
  4000.         collection._first_disp_msg_evenness = 1;
  4001.         G_Assocs[AssocID].TreeView.redraw_collection(CollectionID);
  4002.         return;
  4003.         }
  4004.     //---------------------------------------------------------------------------------------------    
  4005.        if(collection._expanded == 1)
  4006.         {
  4007.         var collection_container_element = document.getElementById('Assoc_'+this._associationID).all[CollectionID+'_container'];
  4008.         if (collection_container_element.children)     var msg_page_length = collection_container_element.children.length;
  4009.         else return;
  4010.         if (msg_page_length<CONST_MESSAGES_ON_PAGE)
  4011.             {
  4012.             //-------------------------------------------------------------------------------------
  4013.             var new_message_element = document.createElement('tbody');            
  4014.             if(InsertPosition == -1) {
  4015.                                         collection_container_element.appendChild(new_message_element);
  4016.                                         BuildMessageAsObject(new_message_element, CollectionID, MsgID, (collection._first_disp_msg_evenness+msg_page_length)%2); 
  4017.                                      }
  4018.             else                     {
  4019.                                         collection_container_element.insertBefore(new_message_element, collection_container_element.children(InsertPosition));
  4020.                                         var MsgEvenness = (collection._first_disp_msg_evenness+InsertPosition)%2;
  4021.                                         BuildMessageAsObject(new_message_element, CollectionID, MsgID, MsgEvenness);                                         
  4022.                                         var i;
  4023.                                         for(i=InsertPosition + 1; i<=msg_page_length; i++)
  4024.                                             {
  4025.                                             if (MsgEvenness == 0)     {collection_container_element.children(i).className = "Msg_Odd"; MsgEvenness = 1;}
  4026.                                             else                     {collection_container_element.children(i).className = "Msg_Even"; MsgEvenness = 0;}
  4027.                                             }                                        
  4028.                                      }            
  4029.             
  4030.             }
  4031.         //---------------------------------------------------------------------------------------
  4032.         else // if (msg_page_length >=CONST_MESSAGES_ON_PAGE)
  4033.             {                        
  4034.             var new_message_element = document.createElement('tbody');
  4035.             collection_container_element.removeChild(collection_container_element.children(CONST_MESSAGES_ON_PAGE-1));
  4036.             if(InsertPosition == -1) {
  4037.                                         collection_container_element.appendChild(new_message_element);
  4038.                                         BuildMessageAsObject(new_message_element, CollectionID, MsgID, (collection._first_disp_msg_evenness+msg_page_length)%2); 
  4039.                                      }
  4040.             else                      {                                        
  4041.                                         collection_container_element.insertBefore(new_message_element, collection_container_element.children(InsertPosition));
  4042.                                         var MsgEvenness = (collection._first_disp_msg_evenness+InsertPosition)%2;
  4043.                                         BuildMessageAsObject(new_message_element, CollectionID, MsgID, MsgEvenness);                                         
  4044.                                         var i;
  4045.                                         for(i=InsertPosition + 1; i<CONST_MESSAGES_ON_PAGE ;i++)
  4046.                                             {
  4047.                                             if (MsgEvenness == 0)     {collection_container_element.children(i).className = "Msg_Odd"; MsgEvenness = 1;}
  4048.                                             else                     {collection_container_element.children(i).className = "Msg_Even"; MsgEvenness = 0;}
  4049.                                             }                                        
  4050.                                      }            
  4051.             }
  4052.         //--------if (msg_page_length >=CONST_MESSAGES_ON_PAGE) end------------------------------
  4053.         }
  4054.     };
  4055.    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4056.   this.click=function(CollectionID)                     // expands or collaps node
  4057.   {
  4058.     this.root._children[CollectionID]._expanded = 1-this.root._children[CollectionID]._expanded;    
  4059.     this._collections[CollectionID].obj.Method1('M_SetCollectionState',this.root._children[CollectionID]._expanded);
  4060.     this.redraw_collection(CollectionID);    
  4061.   };   
  4062.   
  4063.   return this;
  4064. };  // CreateTree() end
  4065.  
  4066.  
  4067. function ExtChangeBannerState(State)
  4068. {    
  4069.     var El = document.getElementById('Banner_place');             
  4070.     if (State == 1) 
  4071.         {
  4072.         El.style.display = '';
  4073.         //Banner_on_off.title=external.LS('hint_Banner_on');        
  4074.         }
  4075.     else 
  4076.         {
  4077.         El.style.display = 'none';    
  4078.         //Banner_on_off.title=external.LS('hint_Banner_off');
  4079.         }
  4080.     ResizeWindow();
  4081. }
  4082.  
  4083. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4084. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4085. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4086. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4087. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4088. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4089. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4090. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4091.  
  4092. function ExtLinkToCollectionMsg(CollectionName, MsgObjID)
  4093.     {
  4094.     LinkToCollectionMsg(CollectionName, MsgObjID);
  4095.     }
  4096.     
  4097. function LinkToCollectionMsg(CollectionName, MsgObjID)
  4098. {
  4099. var AssocContainer = document.getElementById('Assoc_'+G_ActiveAssocID);
  4100. var CollectionId = G_Assocs[G_ActiveAssocID].TreeView._collectionIdByName[CollectionName];
  4101. //--------------------------------------------------------------------------------
  4102. if(G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionId]._expanded == 0)
  4103.     {
  4104.     OnCollectionExpandIconClick(G_ActiveAssocID, CollectionId);
  4105.     }
  4106. //--------------------------------------------------------------------------------
  4107. var LinkID = 'Link'+CollectionId+MsgObjID;
  4108. var LinkItem = document.getElementById(LinkID);
  4109. if(LinkItem == null) 
  4110.     {
  4111.     var CollectionObj = external.ObjById(CollectionId);    
  4112.     var msg = CollectionObj.Method1('M_GetItemBySolutionID',MsgObjID);
  4113.     if (msg == null) return;
  4114.     var solution = msg.GetObjM('m_SolutionWPtr');
  4115.     
  4116.     if (solution.objID == MsgObjID)
  4117.         {                
  4118.         var counter = 0;
  4119.         var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionId].obj;
  4120.         var FirstMsg = msgs.GetFirst();    
  4121.         var msg2 = msgs.GetLast();
  4122.         var solution2 = msg2.GetObjM('m_SolutionWPtr');
  4123.  
  4124.         while((solution2.objID != MsgObjID) && (counter < CONST_MESSAGES_ON_PAGE))
  4125.             {            
  4126.             msg2 = msgs.GetPrev(msg2);        
  4127.             solution2 = msg2.GetObjM('m_SolutionWPtr');
  4128.             counter = counter + 1;
  4129.             }
  4130.             
  4131.         if (counter == CONST_MESSAGES_ON_PAGE) 
  4132.             {
  4133.             CollectionObj.Method1('M_SetFirstVisibleMessageByIndex', CollectionObj.Method1('M_GetMessageIndexByID', msg.objID));
  4134.             }
  4135.         else
  4136.             {
  4137.             for (i = CONST_MESSAGES_ON_PAGE; i > counter + 1; i--)                                   
  4138.                 {
  4139.                 msg2 = msgs.GetPrev(msg2);        
  4140.                 solution2 = msg2.GetObjM('m_SolutionWPtr');
  4141.                 }
  4142.             CollectionObj.Method1('M_SetFirstVisibleMessageByIndex', CollectionObj.Method1('M_GetMessageIndexByID', msg2.objID));
  4143.             }
  4144.         
  4145.         G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionId);        
  4146.         LinkItem = document.getElementById(LinkID);
  4147.         if (LinkItem != null) LinkItem.scrollIntoView(true);
  4148.         }
  4149.     else if (msg.objID == msgs.GetLast().objID)
  4150.         {
  4151.         alert('LinkItem is not found');
  4152.         }        
  4153.     }
  4154. else 
  4155.     {
  4156.     LinkItem.scrollIntoView(true);
  4157.     }
  4158. }
  4159.  
  4160. //------------------------------------------------------------
  4161. // progress Bar block
  4162. //------------------------------------------------------------
  4163.  
  4164. function ExtUpdateProgressBar(AssocID, State, Percents)
  4165. {
  4166.     var processName = "undefined";
  4167.     var stateString = "undefined"; 
  4168.     var titleString = "";
  4169.  
  4170.     if ((State == null) || (State == 0) || (State == 2))
  4171.     {
  4172.         document.getElementById("sliderWrapper").style.visibility = "hidden";
  4173.         document.getElementById("sliderWrapper").firstChild.nodeValue = 0 + "%";
  4174.         document.getElementById("slider").firstChild.nodeValue = 0 + "%";
  4175.  
  4176.         if (State == 0) 
  4177.         {
  4178.             var AssocObj = external.ObjByID(AssocID);
  4179.             var Status = AssocObj.Method0('M_GetAggregatedGeneralStatus');
  4180.             if (Status == STATUS_ATTRIBUTE_AUTOMATIC || Status == STATUS_ATTRIBUTE_AUTOMATIC_INTERNAL)
  4181.             {
  4182.                 stateString = external.LS("Auto_Sync_Is_On");
  4183.                 titleString = external.LS("tooltip_Auto_Sync_Is");
  4184.             }
  4185.             else
  4186.             {
  4187.                 stateString = external.LS("Auto_Sync_Is_Off");
  4188.                 titleString = external.LS("tooltip_Auto_Sync_Is");
  4189.             }
  4190.         }
  4191.         else if (State == 2)
  4192.         {
  4193.             stateString = external.LS("Pr_Bar_A_Is_Done");
  4194.             titleString = "";
  4195.         }
  4196.     }
  4197.     else
  4198.     {    
  4199.         //-------------------------------------------------------------------------------------
  4200.         if (State == 1)        processName = external.LS("Pr_Bar_Analyzing");
  4201.         else if    (State == 3)    processName = external.LS("Pr_Bar_Synchronizing");
  4202.         //-------------------------------------------------------------------------------------
  4203.         var factor = Percents/100;
  4204.         var pct = Math.ceil(factor*100); 
  4205.         document.getElementById("sliderWrapper").firstChild.nodeValue = processName + pct + "%"; 
  4206.         document.getElementById("slider").firstChild.nodeValue = processName + pct + "%"; 
  4207.         document.getElementById("slider").style.clip = "rect(0px " + parseInt(factor*387) + "px 16px 0px)";
  4208.         document.getElementById("sliderWrapper").style.visibility = "visible";
  4209.     }    
  4210.  
  4211.     document.getElementById("progressBarMsg").innerHTML = stateString; 
  4212.     document.getElementById("progressBarMsg").title = titleString; 
  4213.     return;    
  4214. }
  4215.  
  4216. //--------------------------------------------------------------------------------------------
  4217. //correctPNG block
  4218. //--------------------------------------------------------------------------------------------
  4219.  
  4220. function correctPNG()
  4221. {
  4222. for(var i=0; i<document.images.length; i++)
  4223. {
  4224. var img = document.images[i]
  4225. var imgName = img.src.toUpperCase()
  4226. if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
  4227. {
  4228. var imgID = (img.id) ? "id='" + img.id + "' " : ""
  4229. var imgClass = (img.className) ? "class='" + img.className + "' " : ""
  4230. var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
  4231. var imgStyle = "display:inline-block;" + img.style.cssText
  4232. var imgAttribs = img.attributes;
  4233. var onMouseOver = "", onMouseOut = "";
  4234. for (var j=0; j<imgAttribs.length; j++)
  4235. {
  4236. var imgAttrib = imgAttribs[j];
  4237. if (imgAttrib.nodeName == "align")
  4238. {
  4239. if (imgAttrib.nodeValue == "left") imgStyle = "float:left;" + imgStyle
  4240. if (imgAttrib.nodeValue == "right") imgStyle = "float:right;" + imgStyle
  4241. break
  4242. }
  4243. }
  4244. if (img.name && !img.id) imgID= "id='" + img.name + "' "
  4245. if ((pos=img.outerHTML.toUpperCase().indexOf("ONMOUSEOVER="))>0) {
  4246.     onMouseOver=img.outerHTML.substring(pos);
  4247.     pos=onMouseOver.indexOf(");");
  4248.     if (onMouseOver.substr(12,1)== "\"") pos=onMouseOver.indexOf(");\"");
  4249.     onMouseOver=" " + onMouseOver.substring(0,pos+2).replace("MM_swap","MM_PNGswap") + ((onMouseOver.substr(12,1)== "\"") ? "\"":"") + " ";
  4250. }
  4251. pos=0
  4252. if ((pos=img.outerHTML.toUpperCase().indexOf("ONMOUSEOUT="))>0) {
  4253.     onMouseOut=img.outerHTML.substring(pos);
  4254.     pos=onMouseOut.indexOf(");");
  4255.     if (onMouseOut.substr(11,1)== "\"") pos=onMouseOut.indexOf(");\"");
  4256.     onMouseOut=" " + onMouseOut.substring(0,pos+2).replace("MM_swap","MM_PNGswap") + ((onMouseOut.substr(11,1)== "\"") ? "\"":"") + " ";
  4257. }
  4258. pos=0
  4259. var strNewHTML = "<span " + imgID + imgClass + imgTitle
  4260. strNewHTML += " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
  4261. strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
  4262. strNewHTML += "(src=\'" + img.src + "\', sizingMethod='scale');\"";
  4263. strNewHTML += onMouseOver + onMouseOut + "></span>"
  4264. img.outerHTML = strNewHTML
  4265. i = i-1
  4266. }
  4267. }
  4268.  
  4269. for(var i=0; i<document.links.length; i++)
  4270. {
  4271. var lnk = document.links[i];
  4272. var tStr="";
  4273. if ((pos=lnk.outerHTML.indexOf("MM_swapImage("))>0) {
  4274.     tStr=lnk.outerHTML.substring(pos+13);
  4275.     pos=tStr.indexOf(");");
  4276.     if (pos>0) {
  4277.         pos=tStr.substring(0,pos).toUpperCase().indexOf(".PNG");
  4278.         if (pos>0) lnk.outerHTML = lnk.outerHTML.replace(/MM_swap/g,"MM_PNGswap");
  4279.     }
  4280. }
  4281. }
  4282.  
  4283. }
  4284.  
  4285. function MM_PNGswapImage() { //v3.0
  4286.     var i,j=0,x,a=MM_PNGswapImage.arguments;
  4287.     document.MM_sr=new Array;
  4288.     for(i=0;i<(a.length-2);i+=3)
  4289.         if ((x=MM_findObj(a[i]))!=null){
  4290.             document.MM_sr[j++]=x;
  4291.             if(!x.oSrc) x.oSrc=x.filters(0).src; 
  4292.             x.filters(0).src=a[i+2];
  4293.         }
  4294. }
  4295.  
  4296. function MM_PNGswapImgRestore() { //v3.0
  4297.     var i,x,a=document.MM_sr;
  4298.     for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.filters(0).src=x.oSrc;
  4299. }
  4300.  
  4301. window.attachEvent("onload", correctPNG);
  4302.  
  4303. //--------------------------------------------------------------------------------------------
  4304. //end of correctPNG block
  4305. //--------------------------------------------------------------------------------------------
  4306.  
  4307. function OnSortItemClick(Sort_Type, CollectionID)
  4308. {
  4309. var Last_Sort_Info = 'Sort_by_default';
  4310. var New_Sort_Info = 'Sort_by_default';
  4311. //----------------------------------------------------
  4312. var msgs = external.ObjByID(CollectionID);
  4313. var Last_Sort_ID = msgs.Method0('M_GetSortingCriterion'); 
  4314. var TreeID = msgs.Method0('M_GetSortingTree');
  4315. //----------------------------------------------------
  4316. var AssocObj = external.ObjByID(G_ActiveAssocID);
  4317. var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  4318. var SuperTree_Obj = SuperTreeList.GetFirst();
  4319. var Tree_0_ID = SuperTree_Obj.objID;
  4320.     SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  4321. var Tree_1_ID = SuperTree_Obj.objID;
  4322. //-----------------------------------------------------------------------------------------------
  4323. if ((Last_Sort_ID == '646E6563736544435174726F53676E69') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_name_down_1';}
  4324. else
  4325. if ((Last_Sort_ID == '69646E6563734143464974726F53676E') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_name_up_1';}
  4326. else
  4327. if ((Last_Sort_ID == '646E6563736544436B74726F53676E69') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_size_down_1';}
  4328. else
  4329. if ((Last_Sort_ID == '69646E6563734143604974726F53676E') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_size_up_1';}
  4330. else
  4331. if ((Last_Sort_ID == '646E6563736544435F74726F53676E69') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_time_down_1';}
  4332. else
  4333. if ((Last_Sort_ID == '69646E6563734143544974726F53676E') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_time_up_1';}
  4334. //-----------------------------------------------------------------------------------------------    
  4335. else
  4336. if ((Last_Sort_ID == '646E6563736544435174726F53676E69') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_name_down_2';}
  4337. else
  4338. if ((Last_Sort_ID == '69646E6563734143464974726F53676E') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_name_up_2';}
  4339. else
  4340. if ((Last_Sort_ID == '646E6563736544436B74726F53676E69') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_size_down_2';}
  4341. else
  4342. if ((Last_Sort_ID == '69646E6563734143604974726F53676E') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_size_up_2';}
  4343. else
  4344. if ((Last_Sort_ID == '646E6563736544435F74726F53676E69') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_time_down_2';}
  4345. else
  4346. if ((Last_Sort_ID == '69646E6563734143544974726F53676E') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_time_up_2';}    
  4347. //-----------------------------------------------------------------------------------------------
  4348. else
  4349. if ((Last_Sort_ID == '646E6563736544434374726F53676E69')) {Last_Sort_Info = 'Sort_by_winner_down';}
  4350. else
  4351. if ((Last_Sort_ID == '69646E6563734143744974726F53676E')) {Last_Sort_Info = 'Sort_by_winner_up';}    
  4352. //-----------------------------------------------------------------------------------------------
  4353. if (Sort_Type == 'name_1') {
  4354.     if (Last_Sort_Info != 'Sort_by_name_up_1')  New_Sort_Info = 'Sort_by_name_up_1';        
  4355.     else                                        New_Sort_Info = 'Sort_by_name_down_1';    
  4356.     }    
  4357. if (Sort_Type == 'name_2') {
  4358.     if (Last_Sort_Info != 'Sort_by_name_up_2')  New_Sort_Info = 'Sort_by_name_up_2';        
  4359.     else                                        New_Sort_Info = 'Sort_by_name_down_2';    
  4360.     }    
  4361. //-----------------------
  4362. if (Sort_Type == 'size_1') {
  4363.     if (Last_Sort_Info != 'Sort_by_size_up_1')  New_Sort_Info = 'Sort_by_size_up_1';
  4364.     else                                         New_Sort_Info = 'Sort_by_size_down_1';    
  4365.     }
  4366. if (Sort_Type == 'size_2') {
  4367.     if (Last_Sort_Info != 'Sort_by_size_up_2')  New_Sort_Info = 'Sort_by_size_up_2';
  4368.     else                                         New_Sort_Info = 'Sort_by_size_down_2';    
  4369.     }    
  4370. //-----------------------
  4371. if (Sort_Type == 'time_1') {
  4372.     if (Last_Sort_Info != 'Sort_by_time_up_1')  New_Sort_Info = 'Sort_by_time_up_1';
  4373.     else                                         New_Sort_Info = 'Sort_by_time_down_1';                    
  4374.     }
  4375. if (Sort_Type == 'time_2') {
  4376.     if (Last_Sort_Info != 'Sort_by_time_up_2')  New_Sort_Info = 'Sort_by_time_up_2';
  4377.     else                                         New_Sort_Info = 'Sort_by_time_down_2';                    
  4378.     }
  4379. //-----------------------
  4380. if (Sort_Type == 'winner') {
  4381.     if (Last_Sort_Info != 'Sort_by_winner_up')  New_Sort_Info = 'Sort_by_winner_up';
  4382.     else                                         New_Sort_Info = 'Sort_by_winner_down';                    
  4383.     }
  4384. //-----------------------
  4385. G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].sort = New_Sort_Info;
  4386. //-----------------------
  4387.  
  4388. var AssocObj = external.ObjByID(G_ActiveAssocID);
  4389. var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  4390. var SuperTree_Obj = SuperTreeList.GetFirst();
  4391. var Tree_0_ID = SuperTree_Obj.objID;
  4392.     SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  4393. var Tree_1_ID = SuperTree_Obj.objID;
  4394. //------------------------------------------------------------------------------------------------------------------
  4395. if ((New_Sort_Info == 'Sort_by_name_down_1')) {New_Sort_ID = '646e6563736544435174726f53676e69'; TreeID = Tree_0_ID;}
  4396. else
  4397. if ((New_Sort_Info == 'Sort_by_name_up_1'))   {New_Sort_ID = '69646e6563734143464974726f53676e'; TreeID = Tree_0_ID;}
  4398. else
  4399. if ((New_Sort_Info == 'Sort_by_size_down_1')) {New_Sort_ID = '646e6563736544436b74726f53676e69'; TreeID = Tree_0_ID;}
  4400. else
  4401. if ((New_Sort_Info == 'Sort_by_size_up_1'))   {New_Sort_ID = '69646e6563734143604974726f53676e'; TreeID = Tree_0_ID;}
  4402. else
  4403. if ((New_Sort_Info == 'Sort_by_time_down_1')) {New_Sort_ID = '646e6563736544435f74726f53676e69'; TreeID = Tree_0_ID;}
  4404. else
  4405. if ((New_Sort_Info == 'Sort_by_time_up_1'))   {New_Sort_ID = '69646e6563734143544974726f53676e'; TreeID = Tree_0_ID;}
  4406. //-------------------------------------------------------------------------------------------------------------------    
  4407. else
  4408. if ((New_Sort_Info == 'Sort_by_name_down_2')) {New_Sort_ID = '646e6563736544435174726f53676e69'; TreeID = Tree_1_ID;}
  4409. else
  4410. if ((New_Sort_Info == 'Sort_by_name_up_2'))   {New_Sort_ID = '69646e6563734143464974726f53676e'; TreeID = Tree_1_ID;}
  4411. else
  4412. if ((New_Sort_Info == 'Sort_by_size_down_2')) {New_Sort_ID = '646e6563736544436b74726f53676e69'; TreeID = Tree_1_ID;}
  4413. else
  4414. if ((New_Sort_Info == 'Sort_by_size_up_2'))   {New_Sort_ID = '69646e6563734143604974726f53676e'; TreeID = Tree_1_ID;}
  4415. else
  4416. if ((New_Sort_Info == 'Sort_by_time_down_2')) {New_Sort_ID = '646e6563736544435f74726f53676e69'; TreeID = Tree_1_ID;}
  4417. else
  4418. if ((New_Sort_Info == 'Sort_by_time_up_2'))   {New_Sort_ID = '69646e6563734143544974726f53676e'; TreeID = Tree_1_ID;}    
  4419. //-----------------------------------------------------------------------------------------------
  4420. else
  4421. if (New_Sort_Info == 'Sort_by_winner_down')      {New_Sort_ID = '646e6563736544434374726f53676e69';}
  4422. else
  4423. if (New_Sort_Info == 'Sort_by_winner_up'  )   {New_Sort_ID = '69646e6563734143744974726f53676e';}    
  4424. //-----------------------------------------------------------------------------------------------
  4425. msgs.Method2('M_SetSortingCriterion', New_Sort_ID, TreeID);
  4426.  
  4427. //msgs.Method1('M_SetFirstVisibleMessageByIndex', 0);
  4428. G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);
  4429. //-----------------------------------------------------------------------------------------------
  4430. }
  4431.  
  4432. function ExtRedrawCollection(CollectionID)
  4433. {
  4434. G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);
  4435. }
  4436.  
  4437. //---------------------------------------------------------------------------------------------------------
  4438. // DHTML Library
  4439. //---------------------------------------------------------------------------------------------------------
  4440. // Global variables
  4441. var     isCSS,
  4442.         isW3C,
  4443.         isIE4,
  4444.         isNN4,
  4445.         isIE6CSS;
  4446.         
  4447. // Initialization after loading
  4448. function initDHTMLAPI() //Ok
  4449. {
  4450.     if (document.images)
  4451.         {
  4452.         isCSS         = (document.body         && document.body.style                            )    ? true : false;
  4453.         isW3C        = (isCSS                 && document.getElementById                        )     ? true : false;
  4454.         isIE4         = (isCSS                 && document.all                                    )    ? true : false;
  4455.         isNN4         = (document.layers                                                        )    ? true : false;
  4456.         isIE6CSS     = (document.compatMode     && document.compatMode.indexOf("CSS1") >=0         )    ? true : false;
  4457.         } 
  4458. }
  4459.  
  4460. //
  4461. function seekLayer(doc, name)
  4462. {
  4463. var theObj;
  4464. for (var i = 0; i < doc.layers.length; i++)
  4465.     {
  4466.     if (doc.layers.name == name)
  4467.         {
  4468.         theObj = doc.layers[i];
  4469.         break;
  4470.         }
  4471.     }
  4472. if (doc.layers[i].document.layers.length > 0)    
  4473.     {
  4474.     theObj = seekLayer(document.layers[i], document.name);
  4475.     }
  4476. return theObj;    
  4477. }
  4478.  
  4479. //
  4480. function getRawObject(obj)
  4481. {
  4482. var theObj;
  4483. if (typeof obj == "string")
  4484.     {
  4485.     if (isW3C)                     theObj = document.getElementById(obj);
  4486.     else    if (isIE4)             theObj = document.all(obj);
  4487.             else     if(isNN$)     theObj = seekLayer(document, obj);
  4488.     }
  4489. else                            theObj = obj;
  4490. return theObj;    
  4491. }
  4492.  
  4493. //
  4494. function getObject(obj)
  4495. {
  4496. var theObj = getRawObject(obj);
  4497. if (theObj && isCSS) 
  4498.     {
  4499.     theObj = theObj.style;
  4500.     }
  4501. return theObj;    
  4502. }
  4503.  
  4504. //
  4505. function shiftTo(obj, x, y)
  4506. {
  4507. var theObj = getObject(obj); 
  4508. if (theObj)
  4509.     {    
  4510.     if (isCSS)
  4511.         {
  4512.         var units         = (typeof theObj.left == "string") ? "px" : 0;
  4513.         theObj.left        = x + units;
  4514.         theObj.top         = y + units;
  4515.         }
  4516.     else if (isNN4)    theObj.moveTo(x,y);                
  4517.     }    
  4518. }
  4519.  
  4520. //
  4521. function shiftBy(obj, deltaX, deltaY)
  4522. {
  4523. var theObj = getObject(obj);
  4524. if (theObj)
  4525.     {
  4526.     if (isCSS)
  4527.         {
  4528.         var units = (typeof theObj.left == "string") ? "px" : 0;
  4529.         theObj.left = getObjectLeft(obj) + deltaX + units;
  4530.         theObj.top =  getObjectTop(obj)  + deltaY + units;
  4531.         }
  4532.     else    if (isNN4) theObj.moveBy(deltaX, deltaY);    
  4533.     }
  4534. }
  4535.  
  4536. //
  4537. function setZIndex(obj, zOrder)
  4538. {
  4539. var theObj = getObject(obj);
  4540. if (theObj) theObj.zIndex = zOrder;
  4541. }
  4542.  
  4543. //
  4544. function setBGColor(obj, color)
  4545. {
  4546. var theObj = getObject(obj);
  4547. if (theObj)
  4548.     {
  4549.     if (isNN4) theObj.bgColor = color;
  4550.     else if (isCSS) theObj.backgroundColor = color;    
  4551.     }    
  4552. }
  4553.  
  4554. //
  4555. function show(obj)
  4556. {
  4557. var theObj = getObject(obj);
  4558. if (theObj)
  4559.     {
  4560.     theObj.visibility = "visible";
  4561.     }
  4562. }
  4563. //
  4564. function hide(obj)
  4565. {
  4566. var theObj = getObject(obj);
  4567. if (theObj)
  4568.     {
  4569.     theObj.visibility = "hidden";
  4570.     }
  4571. }
  4572.  
  4573. //
  4574. function getObjectLeft(obj)
  4575. {
  4576. var elem = getRawObject(obj);
  4577. var result = 0;
  4578. if (document.defaultView)
  4579.     {
  4580.     var style = document.defaultView;
  4581.     var cssDecl = style.getComputedStyle(elem, "");
  4582.     result = cssDecl.getPropertyValue("left");    
  4583.     }
  4584. else     if (elem.currentStyle)         result = elem.currentStyle.left;                        
  4585.         else if (elem.style)        result = elem.style.left;
  4586.              else    if (isNN4)        result = elem.left;
  4587. return parseInt(result);             
  4588. }
  4589.  
  4590. //
  4591. function getObjectTop(obj)
  4592. {
  4593. var elem = getRawObject(obj);
  4594. var result = 0;
  4595. if (document.defaultView)
  4596.     {
  4597.     var style = document.defaultView;
  4598.     var cssDecl = style.getComputedStyle(elem, "");
  4599.     result = cssDecl.getPropertyValue("top");    
  4600.     }
  4601. else     if (elem.currentStyle)         result = elem.currentStyle.top;                        
  4602.         else if (elem.style)        result = elem.style.top;
  4603.              else    if (isNN4)        result = elem.top;
  4604. return parseInt(result);             
  4605. }
  4606.  
  4607. //
  4608. function getObjectWidth(obj)
  4609. {
  4610. var elem = getRawObject(obj);
  4611. var result  = 0;
  4612. if (elem.offsetWidth)                                         result = elem.offsetWidth;
  4613. else    if (elem.clip && elem.clip.width )                     result = elem.clip.width;
  4614.         else     if (elem.style && elem.style.pixelWidth)    result = elem.style.pixelWidth;
  4615. return parseInt(result);
  4616. }
  4617. //
  4618. function getObjectHeight(obj)
  4619. {
  4620. var elem = getRawObject(obj);
  4621. var result  = 0;
  4622. if (elem.offsetHeight)                                         result = elem.offsetHeight;
  4623. else    if (elem.clip && elem.clip.height)                     result = elem.clip.height;
  4624.         else     if (elem.style && elem.style.pixelHeight)    result = elem.style.pixelHeight;
  4625. return parseInt(result);
  4626. }
  4627.  
  4628. //
  4629. function getInsideWindowWidth()
  4630. {
  4631. if (window.innerWidth)                                             return window.innerWidth;
  4632. else    if (isIE6CSS)                                             return document.body.parentElement.clientWidth;
  4633.         else     if(document.body && document.body.clientWidth)    return document.body.clientWidth;
  4634. return 0;        
  4635. }
  4636.  
  4637. //
  4638. function getInsideWindowHeight()
  4639. {
  4640. if (window.innerHeight)                                            return window.innerHeight;
  4641. else    if (isIE6CSS)                                             return document.body.parentElement.clientHeight;
  4642.         else     if(document.body && document.body.clientWidth)    return document.body.clientHeight;
  4643. return 0;        
  4644. }
  4645.  
  4646. //---------------------------------------------------------------------------------------------------------
  4647. // DRAGIMAGE Library
  4648. //---------------------------------------------------------------------------------------------------------
  4649. // Global variables
  4650.  
  4651. var selectedObj;
  4652. var containerObj;
  4653. var offsetX;
  4654. var offsetY;
  4655. var BarX, BarY;
  4656. var msgIndex = null;
  4657. var BarHeight, ContainerHeight;
  4658. var firstElement;
  4659.  
  4660. function setSelectedElem(evt)
  4661. {
  4662. var target = (evt.target)? evt.target : evt.srcElement;
  4663. //------------------------------------------
  4664. var divID = (target.name && target.src) ? target.name + "Wrap" :'';
  4665. if (divID)
  4666.     {
  4667.     selectedObj = document.getElementById(divID);
  4668.     setZIndex(selectedObj, 100);
  4669.     var ContainerDivID = divID + 'Container';
  4670.     if (ContainerDivID) containerObj = document.getElementById(ContainerDivID);
  4671.     return;
  4672.     }
  4673. //------------------------------------------
  4674. // page block
  4675. //------------------------------------------
  4676. divID = (target.collectionID) ? target.id :'';
  4677. if (divID)
  4678.     {
  4679.     var Obj = document.getElementById(target.collectionID + 'BarWrap');
  4680.     if (Obj.offsetTop < evt.offsetY)     go_next_page(target.collectionID);
  4681.     else                                go_prev_page(target.collectionID);    
  4682.     return;
  4683.     }
  4684. //------------------------------------------
  4685.  
  4686. containerObj = null;
  4687. selectedObj = null;
  4688. return;
  4689. }
  4690. //------------------------------------------------------------------------------------------
  4691. function engage(evt)
  4692. {
  4693. evt = (evt) ? evt: event;
  4694. setSelectedElem(evt);
  4695. if (selectedObj)
  4696.     {
  4697.     document.body.setCapture();        
  4698.     offsetX  = evt.clientX - ((selectedObj.offsetLeft) ? selectedObj.offsetLeft : 0);
  4699.     offsetY  = evt.clientY - ((selectedObj.offsetTop ) ? selectedObj.offsetTop  : 0);
  4700.     return false;            
  4701.     }
  4702. }
  4703. //------------------------------------------------------------------------------------------
  4704. var latch = false;
  4705.  
  4706. function dragIt(evt)
  4707. {
  4708. evt = (evt) ? evt : event;
  4709. var x, y, width, height;
  4710. if (selectedObj)
  4711.     {
  4712.     G_Collection_lock = true;    
  4713.     
  4714.     selectedObj.innerHTML='<image src="Pics/ScrBar_moved.gif">';
  4715.     
  4716.     x = evt.clientX - offsetX;
  4717.     y = evt.clientY - offsetY;
  4718.     width  = getObjectWidth(selectedObj);
  4719.     height = getObjectHeight(selectedObj);
  4720.     container_width  = getObjectWidth(containerObj);
  4721.     container_height = getObjectHeight(containerObj);
  4722.     BarHeight = height; 
  4723.     ContainerHeight = container_height;
  4724.     x = (x < 0) ? 0 : ((x + width  > container_width ) ? container_width  - width   : x);
  4725.     y = (y < 0) ? 0 : ((y + height > container_height) ? container_height - height  : y);
  4726.     shiftTo(selectedObj, x, y); 
  4727.     BarX = x;
  4728.     BarY = y;    
  4729.     //----------------------------------
  4730.     var CollectionID = selectedObj.collectionID;
  4731.     var CollectionElement = document.getElementById(CollectionID);
  4732.     var CollectionHeadElement = document.getElementById(CollectionID + '_in');
  4733.  
  4734.     if (latch == false)
  4735.         {
  4736.         //----------------------------------------------------------------------------------
  4737.         var AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  4738.         var collection_container = AssocElement.all[CollectionID+'_container']; 
  4739.         if(collection_container != null) 
  4740.             {
  4741.             i = 0;
  4742.             if (collection_container.children(i) != null)
  4743.                 {                
  4744.                 while (collection_container.children(i))
  4745.                     {             
  4746.                      collection_container.children(i).className = 'Msg_Even';        
  4747.                      i++;             
  4748.                     }            
  4749.                 }    
  4750.             }    
  4751.         //-----------------------------------------------------------------------------------        
  4752.         latch = true;
  4753.         }
  4754.     var  collection = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID]; 
  4755.     if (collection) { var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;}
  4756.     else            { var msgs = null;}
  4757.     
  4758.     if(msgs != null)
  4759.         {        
  4760.         var factor = y/(container_height - height); //alert('factor=' + factor);
  4761.         var counter_value = msgs.Method0('M_GetCount');            
  4762.         var new_first_message_element_number = Math.round(factor * (counter_value - CONST_MESSAGES_ON_PAGE)); //alert(new_first_message_element_number);
  4763.         //------------------------------------------
  4764.         msgIndex = new_first_message_element_number;        
  4765.         firstElement = msgs.Method1('M_GetIDMessageByIndex', new_first_message_element_number); // 0..counter_value-1
  4766.         }
  4767.     //----------------------------------
  4768.     evt.cancelBubble = true;
  4769.     return false;    
  4770.     }
  4771. }
  4772. //------------------------------------------------------------------------------------------
  4773. function release(evt)
  4774. {
  4775. if (selectedObj)
  4776.     {    
  4777.     var CollectionID = selectedObj.collectionID;
  4778.     var  collection = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID]; 
  4779.     if (collection) { var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;}
  4780.     else            { var msgs = null;}
  4781.     if ((msgs) && (msgIndex)) msgs.method1('M_SetFirstVisibleMessageByIndex', msgIndex);
  4782.     else       msgs.method1('M_SetFirstVisibleMessageByIndex', 0);
  4783.  
  4784.     var CollectionID = selectedObj.collectionID;
  4785.     G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);
  4786.     
  4787.     setZIndex(selectedObj, 0);
  4788.     document.body.releaseCapture();    
  4789.     firstElement = null;
  4790.     selectedObj = null;
  4791.     latch = false;
  4792.     msgIndex = null;
  4793.     
  4794.     G_Collection_lock = false;    
  4795.     }
  4796. }
  4797. //------------------------------------------------------------------------------------------
  4798. function initDrag() 
  4799. {
  4800. document.onmousedown = engage;
  4801. document.onmousemove = dragIt;
  4802. document.onmouseup = release;
  4803. document.onmousewheel = scrollIt;
  4804. return;
  4805. }
  4806. //------------------------------------------------------------------------------------------
  4807. var wheel_lock = false;
  4808.  
  4809. function scrollIt(CollectionID)
  4810. {  
  4811.   //-----------------------------------
  4812.   if (wheel_lock == true) return false;
  4813.   //-----------------------------------
  4814.   
  4815.   event.cancelBubble = false;
  4816.   
  4817.   if (!G_Assocs[G_ActiveAssocID]) return true;
  4818.   if (!G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID]) return true;  
  4819.   if (G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj)     var collection_message_list  = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  4820.   else                                                                         return true;
  4821.   
  4822.   wheel_lock = true;
  4823.   event.cancelBubble = true;
  4824.   
  4825.   var message_counter_value = collection_message_list.Method0('M_GetCount');    
  4826.   var items_per_page         = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  4827.   if (message_counter_value > items_per_page)
  4828.       {      
  4829.     var collection_node = G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID];
  4830.     var first_msg_index = collection_message_list.Method0('M_GetFirstVisibleMessageIndex');                
  4831.     //----------------------------------------------------------------------------------------------------------------------------------------
  4832.     if ((event.wheelDelta > 0) && (first_msg_index > 0) && (collection_node._expanded == true))    
  4833.             { go_prev_message(CollectionID); wheel_lock = false; return false; }
  4834.     else if ((event.wheelDelta < 0) && (first_msg_index < message_counter_value - items_per_page) && (collection_node._expanded == true)) 
  4835.             { go_next_message(CollectionID); wheel_lock = false; return false; }  
  4836.     else    { wheel_lock = false; return true; }
  4837.     //----------------------------------------------------------------------------------------------------------------------------------------
  4838.       }
  4839.   else { wheel_lock = false; return true; }             
  4840. }
  4841.  
  4842. //----------------------------------------------------------------------------------------                                                        
  4843. // defines states of scrollbar elements
  4844. //----------------------------------------------------------------------------------------                                                        
  4845. function AutoRefreshScrollers(AssocID, CollectionID)
  4846. {
  4847.     //----------------------------------------------------------------------------------------                                                        
  4848.     if (G_Collection_lock == true) return;
  4849.     //----------------------------------------------------------------------------------------                                                        
  4850.     if (G_Assocs[AssocID] == null) return;
  4851.     if (G_Assocs[AssocID].TreeView == null) return;
  4852.     if (G_Assocs[AssocID].TreeView._collections[CollectionID] == null) return;
  4853.     var msgs             = G_Assocs[AssocID].TreeView._collections[CollectionID].obj;
  4854.     if (msgs == null) return;
  4855.     //----------------------------------------------------------------------------------------                                                        
  4856.     var msgs_count         = msgs.Method0('M_GetCount');
  4857.     var msgs_per_page      = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  4858.     //----------------------------------------------------------------------------------------                                                        
  4859.     var first_msg        = msgs.GetFirst();
  4860.     var last_msg        = msgs.GetLast();
  4861.     if ((first_msg != null) && (last_msg != null))
  4862.         {
  4863.         var first_msg_id    = first_msg.objID;
  4864.         var last_msg_id        = last_msg.objID;
  4865.         }
  4866.     else return;    
  4867.     //----------------------------------------------------------------------------------------                                                        
  4868.     var msg = msgs.Method0('M_GetFirstVisibleMessage');        
  4869.     var firstVisibleMsgID='';
  4870.     if (msg != null) firstVisibleMsgID = msg.objID;
  4871.     var lastVisibleMsgID ='';    
  4872.     if (msg != null) lastVisibleMsgID = msg.objID;
  4873.     while (msg != null)    
  4874.         {
  4875.         msg = msgs.Method1('M_GetNextVisibleMessage', msg);
  4876.         if (msg != null) { lastVisibleMsgID = msg.objID;}            
  4877.         }
  4878.     //----------------------------------------------------------------------------------------                                                            
  4879.     if (msgs_per_page < msgs_count) 
  4880.         {
  4881.         var MsgScrollersExist = true;
  4882.         //---------------------------------------------------------
  4883.         if (first_msg_id == firstVisibleMsgID) var prev_state = false;
  4884.         else                                 var prev_state = true;
  4885.         //---------------------------------------------------------
  4886.         if (last_msg_id == lastVisibleMsgID) var next_state = false;
  4887.         else                               var next_state = true;
  4888.         //---------------------------------------------------------
  4889.         }
  4890.     else
  4891.         {
  4892.         var MsgScrollersExist = false;
  4893.         var prev_state = false;
  4894.         var last_state = false;
  4895.         }
  4896.     //----------------------------------------------------------------------------------------                                                            
  4897.     var assoc_element = document.getElementById('Assoc_'+AssocID);
  4898.     
  4899.     RefreshMsgScrollers(assoc_element, "prev", prev_state, CollectionID, MsgScrollersExist);
  4900.     RefreshMsgScrollers(assoc_element, "next", next_state, CollectionID, MsgScrollersExist);
  4901. }
  4902. //----------------------------------------------------------------------------------------------------------
  4903. //
  4904. //----------------------------------------------------------------------------------------------------------
  4905. function ExtRemoveMsg(MsgCollectionObjID, MsgObjID)
  4906.     {
  4907.     if (G_Collection_lock == true) return;
  4908.     
  4909.     if((G_Above_message.msg_id == MsgObjID) && (G_Above_message.collection_id == MsgCollectionObjID))    G_Above_message.mustshown = false;
  4910.         
  4911.     G_Shown_message.collection_id = null;
  4912.     G_Shown_message.msg_id = null;
  4913.     //------------------------------------
  4914.     var msg = external.ObjByID(MsgObjID);
  4915.     if(msg == null) return;
  4916.     //------------------------------------    
  4917.     var AssocID = msg.GetM('m_SlnDoAssocSyncWPtr').objID;
  4918.     if(G_Assocs[AssocID].TreeView._collections[MsgCollectionObjID] == null) return;
  4919.     //------------------------------------    
  4920.     var collection_container = document.getElementById('Assoc_'+AssocID).all[MsgCollectionObjID+'_container'];     if (collection_container.children == null) return;
  4921.     //---------------------------------------------------------------    
  4922.     var message_element = collection_container.children[MsgObjID]; 
  4923.     if(message_element == null)                 return;        
  4924.     else if(message_element.exist == 'false')     return;        
  4925.     //---------------------------------------------------------------    
  4926.     if(message_element.className.match(/Msg_Odd/))     MsgEvenness = 1;
  4927.     else                                            MsgEvenness = 0;            
  4928.     ChangeMessageIntoRemovedObject(message_element, MsgCollectionObjID, MsgObjID, MsgEvenness); 
  4929.     }
  4930. //----------------------------------------------------------------------------------------------------------
  4931. //
  4932. //----------------------------------------------------------------------------------------------------------
  4933.  
  4934. function ChangeMessageIntoRemovedObject(message_tbody_element, CollectionID, MessageID, MsgEvenness)
  4935. {        
  4936.     message_tbody_element.id = MessageID;
  4937.     message_tbody_element.className = 'Msg_Removed';
  4938.     message_tbody_element.oncontextmenu = 'return;'
  4939.     
  4940.     for(i in message_tbody_element.children)        
  4941.         {
  4942.         if (i.onclick) i.onclick='return;';
  4943.         if (i.onmouseleave) i.onmouseleave='return;';
  4944.         if (i.onmouseenter) i.onmouseenter='return;';
  4945.         }
  4946. }
  4947.  
  4948. function ExtUpdateAfterRemove(CollectionID)
  4949. {
  4950.     var collection_container_element = document.getElementById(CollectionID+'_container');    
  4951.     if (collection_container_element == null) return;
  4952.     var collection_container_length = collection_container_element.children.length; //alert(collection_container_length);
  4953.     //----------------------------------------------------------------------------------------                                                        
  4954.     var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  4955.     var msgs_count = msgs.Method0('M_GetCount'); //alert(msgs_count);
  4956.     //----------------------------------------------------------------------------------------                                                        
  4957.     if (msgs_count == 0) 
  4958.         {        
  4959.         var collection_node = G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID];
  4960.         collection_node._empty = true;        
  4961.         G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);    
  4962.         return;
  4963.         }    
  4964.     //----------------------------------------------------------------------------------------                                                        
  4965.     var msg = msgs.Method0('M_GetFirstVisibleMessage');        
  4966.     var msgID = msg.objID;
  4967.     var i = 0;
  4968.     //----------------------------------------------------------------------------------------                                                        
  4969.     while ((msg != null) && (i < collection_container_length))    
  4970.         {
  4971.         if (collection_container_element.children(i).id != msgID)
  4972.             {                
  4973.             var message_element = collection_container_element.children(i);
  4974.             var  MsgEvenness = 1;
  4975.             BuildMessageAsObject(message_element, CollectionID, msgID, MsgEvenness); 
  4976.             }        
  4977.         msg = msgs.Method1('M_GetNextVisibleMessage', msg);
  4978.         if (msg != null) msgID = msg.objID;
  4979.         i++;
  4980.         }
  4981.     //----------------------------------------------------------------------------------------                                                        
  4982.     if (msg == null)
  4983.         {
  4984.         while(collection_container_element.children(i))
  4985.             {
  4986.             message_container_element = collection_container_element.children(i);
  4987.             message_container_element.removeNode(true);
  4988.             }
  4989.         }
  4990.     else
  4991.         {
  4992.         while (msg != null)
  4993.             {
  4994.             var Assoc    = msg.GetM('m_SlnDoAssocSyncWPtr');
  4995.             var AssocID = Assoc.objID;
  4996.             if(G_Assocs[AssocID].TreeView._collections[MsgCollectionObjID] != null)
  4997.             G_Assocs[AssocID].TreeView.add_message_node(MsgCollectionObjID, MsgObjID, -1);
  4998.             
  4999.             msg = msgs.Method1('M_GetNextVisibleMessage', msg);
  5000.             msgID = msg.objID;
  5001.             }
  5002.         }    
  5003.     //----------------------------------------------------------------------------------------                                                        
  5004.     i = 0;
  5005.     var MsgEvenness = 1;
  5006.     while (collection_container_element.children(i))
  5007.         {             
  5008.          if(MsgEvenness == 0) collection_container_element.children(i).className = 'Msg_Even';                
  5009.          else                   collection_container_element.children(i).className = 'Msg_Odd';                
  5010.          MsgEvenness = 1 - MsgEvenness;
  5011.          i++;             
  5012.         }        
  5013.     //----------------------------------------------------------------------------------------                                                        
  5014.     AutoRefreshScrollers(AssocID, CollectionID);
  5015.     //----------------------------------------------------------------------------------------                                                        
  5016. }
  5017.